Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
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 |
---|---|
125 | |
106 | |
99 | |
63 | |
62 |
User | Count |
---|---|
135 | |
116 | |
101 | |
71 | |
61 |