Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
If I want to calculate percentage of costs vs sales amounts, I tried using the quick measure percentage difference. It gave me this code:
Measure1 % difference from Sales amount =
VAR __BASELINE_VALUE =
SUM('Sales'[Sales amount])
VAR __VALUE_TO_COMPARE =
'Sales'[Measure1]
RETURN
DIVIDE(__VALUE_TO_COMPARE - __BASELINE_VALUE; __BASELINE_VALUE)
This gives a negative percentage. If I remove the substraction in the DIVIDE line to:
DIVIDE(__VALUE_TO_COMPARE; __BASELINE_VALUE)
The return is the correct percentage that I would get with:
Measure% = CALCULATE('Sales'[Measure1]) / SUM('Sales'[Sales amount]) *100
Is this an issue with me not understanding what "Percentage difference" is meant to do or is this something else?
Solved! Go to Solution.
Hi @MHongisto,
"Percentage difference" is under the submenu "Mathematical operations". It looks like a math theory, which evaluates the difference and compare with the base value. Please refer to Percent of Increase or Decrease if you'd like to.
Best Regards!
Dale
Hi @MHongisto,
"Percentage difference" is under the submenu "Mathematical operations". It looks like a math theory, which evaluates the difference and compare with the base value. Please refer to Percent of Increase or Decrease if you'd like to.
Best Regards!
Dale
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))
Thank you! So it was an issue with me not understanding math or English.
Percentage type just displays 0.7 or 1.5 as 70 % or 150%
So DIVIDE(Sales;Base) is correct if your sales are 1500 and your base is 1000 result is 1.5 so displayed as 150% when you change it to Percentage
The Quick measure - Percentage difference calculation automatically puts the subtraction in DIVIDE. I don't understand why. Bug or feature?
Its a Percentage DIFFERENCE
Its just a recommendation.
It makes sense in many scenarios like:
Base 1000 Value 1020
Quick measure gives you 2%
Does not mean that its always correct in your specific scenario if you don't want 2% but 102% then you don't subtract.
Theres no right and wrong here depends on what you need.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
144 | |
87 | |
65 | |
50 | |
45 |
User | Count |
---|---|
217 | |
88 | |
81 | |
65 | |
56 |