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.
Hi,
I created the next measure but got an error saying that doesn't support comparing values of type integer with values of type Text.
Measure 1 = IF(HASONEVALUE('MyTable'[Year]), CALCULATE(AVERAGE('MyTable'Price]), 'MyTable'[Year] = FORMAT(VALUES('MyTable'[Year])-1,BLANK())))
Just to emphasize that column Year is of type INTEGER. If I convert the column 'Year' to type Text, the above formula works, but I want to keep it as integer. Any idea how I can rewrite this formula?
Thanks
Solved! Go to Solution.
Silly me,
you have to rewrite your measure this way
Measure 1 = IF(HASONEVALUE('MyTable'[Year]), CALCULATE( AVERAGE('MyTable'[Price]) ,FILTER( ALL('MyTable'[Year]) ,'MyTable'[Year] = MAX('MyTable'[Year])-1 ) ) ,BLANK() )
I'm sorry for my confusion.
Regards,
Tom
Hey,
I'm wondering why you not just use this
... 'MyTable'[Year] = 'MyTable'[Year]-1
Regards,
Tom
Hi,
I tried that but an error appeared (red line under 'MyTable'[Year]😞
Silly me,
you have to rewrite your measure this way
Measure 1 = IF(HASONEVALUE('MyTable'[Year]), CALCULATE( AVERAGE('MyTable'[Price]) ,FILTER( ALL('MyTable'[Year]) ,'MyTable'[Year] = MAX('MyTable'[Year])-1 ) ) ,BLANK() )
I'm sorry for my confusion.
Regards,
Tom
Tom, absolutely amazing. It works. Please could you explain why did you use 'MAX' function in the FILTER portion of the expression?
Best!
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 |
---|---|
112 | |
97 | |
84 | |
67 | |
59 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |