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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Quick Measure: Incorrect YOY calculation - handling negatives

Hello,

 

YOY quick measure in Power BI results incorrect calculation when previous year data is negative or vice versa. Following quick measure formula results a negative 217% YOY where previous year value is minus 463 and current year value is plus 541. 

 
YTD_Total Sales Gross YoY% =
VAR __PREV_YEAR =
    CALCULATE(
        SUM('Append1'[YTD_Total Sales Gross]),
        DATEADD('Date_Key'[Date], -1, YEAR)
    )
RETURN
    DIVIDE(SUM('Append1'[YTD_Total Sales Gross]) - __PREV_YEAR, __PREV_YEAR)
 
Is there a way to edit the quick measure to add ABS? I'd prefer not create seperate measures for each metric we are tracking and calculate the YOY for each. It will be a very tedious workaround.
 
Thanks,
Petek
1 ACCEPTED SOLUTION
stevedep
Memorable Member
Memorable Member

Hi,

Your formula would be:

YTD_Total Sales Gross YoY% =
VAR __PREV_YEAR =
    CALCULATE(
        SUM('Append1'[YTD_Total Sales Gross]),
        DATEADD('Date_Key'[Date], -1, YEAR)
    )
RETURN
    DIVIDE(SUM('Append1'[YTD_Total Sales Gross]) - __PREV_YEAR, ABS(__PREV_YEAR)

 

Notice the ABS wrapped around the Denominator in the Divide statement. 

 

Please mark as solution if this helps you. Kubos are much appreciated.

 

Kind regards, Steve. 

View solution in original post

4 REPLIES 4
stevedep
Memorable Member
Memorable Member

Hi,

Your formula would be:

YTD_Total Sales Gross YoY% =
VAR __PREV_YEAR =
    CALCULATE(
        SUM('Append1'[YTD_Total Sales Gross]),
        DATEADD('Date_Key'[Date], -1, YEAR)
    )
RETURN
    DIVIDE(SUM('Append1'[YTD_Total Sales Gross]) - __PREV_YEAR, ABS(__PREV_YEAR)

 

Notice the ABS wrapped around the Denominator in the Divide statement. 

 

Please mark as solution if this helps you. Kubos are much appreciated.

 

Kind regards, Steve. 

Anonymous
Not applicable

Thank you Steve - you are indeed "Resolver" 🙂

 

Cheers,

Petek

lbendlin
Super User
Super User

Why would you want to do an ABS conversion?  What is your definition of YoY performance when the previous year was -20 and this year is 30 ? IMHO you should BLANK() out results where the prior year was negative.  Unless both are negative, for example prior year -20 and this year -10 ?  Nah, still doesn't make sense.

Anonymous
Not applicable

Thank you for your response. I hear you, but in our world none of the YOY or growth numbers alone make sense unless we present them with context and a narrative. In this scenario, pre-built quick measure is giving a negative growth although it is positive.  

 
 
 
   w/ABSw/out ABS
CurrentPreviousIncrease (Decrease)% Growth (YOY)% Growth (YOY)
     
1055100%100%
510-5-50%-50%
10-515300%-300%
-105-15-300%-300%
-5-10550%-50%
-10-5-5-100%100%

 

In the spirit of providing solutions, how do you suggest the quick measure to be edited so it returns BLANK(). Your response might help others whose scenario fits the definition.

 

Thank you,

Petek

 

 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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