Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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!
User | Count |
---|---|
103 | |
90 | |
78 | |
72 | |
68 |
User | Count |
---|---|
110 | |
96 | |
95 | |
74 | |
71 |