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.
I am writing an if statement in a measure that says essentially: IF( 'table'[this_date] > 'table'[that_date], 1, 0) but for some reason Power BI is not recognizing the table/columns. The table reference in the statement is grey for some reason and I am not sure why. I expected the statement to recognize the table.
My literal statement is:
Hi @cmckinney
Stanislav_dugas and PhilipTreacy 's reply is helpful. Your dax statement will work well in calculated column instead of measure. Measure will return to aggregation, you need to use max function to get date value.
For more details about difference between measure and calculated column you may refer to blogs as below:
Calculated Columns and Measures in DAX
Calculated Columns vs Measures
Could you tell me if your problem has been solved? If it is, kindly Accept the helpful reply as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.
Best Regards,
Rico Zhou
Hi @cmckinney
You need to aggregate the data in someway when creating a measure so you need to write something like this
Pass_Fail_Flag = IF( MAX('test vPassFailTestResults'[Last Failed]) > MAX('test vPassFailTestResults'[Last Passed]), 0,1 )
Alternatively you could create a Calculated Column and your current syntax would then work without using an aggregation function.
regards
Phil
If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.
Proud to be a Super User!
I am not an expert but when you are trying to create a refference to column inside a meassure you need to use a function like sum/average/distinc.
possible calculation could look like this but it wont give you exactly what you need. but just so you have an idea of how it would look like.
A=Calculate(if(sum('test vPassFailTestResults'[Last Failed])> sum( 'test vPassFailTestResults'[Last Passed]), 0, 1))
Otherwise why dont you create a column? Same function as you have there but instead of meassure create a column. Or is there a particular reason you need to have it as meassure?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
94 | |
80 | |
66 | |
58 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |