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
Hi all,
I'm trying to calculate percentage difference between yesterday's margin and today's margin. Screenshot below of current quick measure (ignore red underline, changed table name for screenshot). For example, yesterday's margin was $500, and today's margin is $600. The measure correctly returns 20%.
However, the measure doesn't seem to work correctly if there is a negative value. For example, yesterday's margin was -$1726, and today's margin is $1217. The measure is returning -170.5% instead of 170.5%. I understand why this is happening, but I'm not sure how to edit the syntax to account for negative values.
Originally, I created a nested if calculated column that used absolute values to account for negatives, but the total row on my table was adding all the % Change in Margin values instead of calculating one % Change in Margin for the table.
Let me know if I can provide any other details. Thanks for your help!
Solved! Go to Solution.
Hi, @Anonymous
It works well on my side.
Please make sure [Yesterday’s Margin] and [Today’s Margin] are t actual columns or calculated columns in the table .
If they are measures, it is recommended to convert them into calculated columns before you using quick measure.
If it doesn't work ,please share your sample file and expected result for further research.
Best Regards,
Community Support Team _ Eason
Thanks for your reply! Technically, I'm looking for it to return +170.5%, not negative.
Hi @Anonymous @v-easonf-msft There's an issue when the base value is negative and the compared value is positive. In general, if the numerator indicates the direction, i.e. increase or decrease, then the denominator must have the absolute value. I am getting around the error in quick measure formula by adding ABS(__BASELINE_VALUE).
--Thus changing
RETURN
DIVIDE(__VALUE_TO_COMPARE - __BASELINE_VALUE; __BASELINE_VALUE)
--to
RETURN
DIVIDE(__VALUE_TO_COMPARE - __BASELINE_VALUE; ABS(__BASELINE_VALUE))
check my reply to post: https://community.powerbi.com/t5/Desktop/Quick-measure-Percentage-difference/m-p/204192
Hi, @Anonymous
It works well on my side.
Please make sure [Yesterday’s Margin] and [Today’s Margin] are t actual columns or calculated columns in the table .
If they are measures, it is recommended to convert them into calculated columns before you using quick measure.
If it doesn't work ,please share your sample file and expected result for further research.
Best Regards,
Community Support Team _ Eason
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
134 | |
91 | |
89 | |
64 | |
58 |
User | Count |
---|---|
201 | |
137 | |
107 | |
72 | |
68 |