March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I have this code in my measure which is giving me type error
MyMeasure =
VAR C = [Measure B]
VAR P = [Measure B]
VAR DIFF = P - C
VAR PERC = ROUND(DIVIDE(DIFF, C, BLANK()) * 100, 2)
RETURN FORMAT(PERC, "0.0%")
and I am receiving this error "comparison operation do not support comparing values of type Text with values of type Number. Consider using the VALUE of FORMAt function to convert one of the value
Solved! Go to Solution.
I change it to this
VAR PERC = DIVIDE(DIFF, C, BLANK())
RETURN PERC
and change from General to Percentage
works fine now
I change it to this
VAR PERC = DIVIDE(DIFF, C, BLANK())
RETURN PERC
and change from General to Percentage
works fine now
as soon as I remove the format function works fine. These values are going into a table that shows values for the current date selection and previous year selection
how can i output the type of the variable TYPE(variable) doesn't work for me
sorry thats my bad. Should be like this
VAR C = [Measure A]
Hi @stribor45
If you check, I am using the same measure (may be data value is not correct) but it will not showing me the error.
Please check all field's datatype including what column your are using for Measure A and Measure B
If require, pelase share sample data or pbix file google drive link
If your requirement is solved, please make sure to MARK AS SOLUTION and help other users find the solution quickly. Please hit the LIKE button if this comment helps you.
Thanks
Pijush
www.MyAccountingTricks.com
https://www.youtube.com/MyAccountingTricks
Proud to be a Super User! | |
I already did that. When I output these values to my table I see numbers. Each of the variables displays similar numbers
Hi @stribor45
Your DIFF should be always 0, right? Because you are suing same measure for C and P
Proud to be a Super User! | |
Hi @stribor45
Please check what is the datatype of [Measure B] text or number
To troubleshoot the issue
In the return statement, Put one by one variable C, P, DIFF, PERC and check what is returning. You can easily find the step which have error.
For Percent formatting, please use below fucntion
https://learn.microsoft.com/en-us/dax/format-function-dax
If your requirement is solved, please make sure to MARK AS SOLUTION and help other users find the solution quickly. Please hit the LIKE button if this comment helps you.
Thanks
Pijush
www.MyAccountingTricks.com
https://www.youtube.com/MyAccountingTricks
Proud to be a Super User! | |
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
114 | |
76 | |
57 | |
52 | |
44 |
User | Count |
---|---|
164 | |
116 | |
63 | |
57 | |
50 |