Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don'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.

Reply
MHongisto
Frequent Visitor

Quick measure - Percentage difference

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?

 

1 ACCEPTED SOLUTION
v-jiascu-msft
Microsoft Employee
Microsoft Employee

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

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-jiascu-msft
Microsoft Employee
Microsoft Employee

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

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

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.

cs_skit
Resolver IV
Resolver IV

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.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.