Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
cyborgandy
Helper II
Helper II

DAX Help

I have created a calculated column in my dataset where it gives me yes or no, however when I writing a different dax to obtain a different count and writing IF (Trying to use the calculated column however its not coming with the IF statement).

e.g Calculated column Name is Within Country and its genetrating yes and no in the rows,

Now wanted to write a DAX for : IF Within Country ="Yes", Calculate(Amount Of Spend), "0" however not able to get within country with IF statement.

Could someone help with the DAX

2 REPLIES 2
v-rzhou-msft
Community Support
Community Support

Hi @cyborgandy ,

 

e.g Calculated column Name is Within Country and its genetrating yes and no in the rows,

Is this mean that you want to check whether the column name within [Country] column , then genetrating yes or no in the rows and calculate the amount for each country return yes.

As far as I know, Power BI is calculated based on columns, so it is difficult for Power BI to catch the column name in calculation. Here I suggest you to use UNPIVOT function to transform your table to make calculation easier.

 

Best Regards,
Rico Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

SivaMani
Resident Rockstar
Resident Rockstar

@cyborgandy, You can't directly reference the column in a measure since the measure expects and returns a single value.

 

You could try the below function and it will show your columns,

https://dax.guide/selectedvalue/

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors