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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Card14x
Regular Visitor

% Change Year over Year

Hi,

 

I am trying to create a measure formula that calculates the % change year over year that also takes into account changes from negative to positive numbers. I have the formula written out in excel below, but when I try to get the same formula written in PBI I get an error saying too few arguments passed. Any help would be greatly appreciated. 

 

Excel Formula

=IF(LY %=0,0,(IF(LY %<0,(( LY % - TY %)/ LY %)*100,(( LY % - TY %)/ LY %)*-100)))

 

PBI Measure

% Change Calculated = IF([LY Shortage Rate Calculated]=0,0,IF([LY Shortage Rate Calculated]>0,([LY Shortage Rate Calculated]-[TY Shortage Rate Calculated]/[LY Shortage Rate Calculated])*-1,IF([LY Shortage Rate Calculated]-[TY Shortage Rate Calculated]/[LY Shortage Rate Calculated])))
2 ACCEPTED SOLUTIONS
dedelman_clng
Community Champion
Community Champion

You have an extra IF towards the end.  Should be

 

% Change Calculated =
IF (
    [LY Shortage Rate Calculated] = 0,
    0,
    IF (
        [LY Shortage Rate Calculated] > 0,
        ( [LY Shortage Rate Calculated]
            - [TY Shortage Rate Calculated] / [LY Shortage Rate Calculated] )
            * -1,
        ( [LY Shortage Rate Calculated]  ##You had an extra IF here
            - [TY Shortage Rate Calculated] / [LY Shortage Rate Calculated] )
    )
)

View solution in original post

Thanks for the quick reply Dedelman_clng! I added in some divides into the formula with your change and it worked perfectly. 

 

% Change Calculated =
IF (
    [LY Shortage Rate Calculated] = 0,
    0,
    IF (
        [LY Shortage Rate Calculated] > 0,
       **DIVIDE** ( [LY Shortage Rate Calculated]
            - [TY Shortage Rate Calculated] , [LY Shortage Rate Calculated] )
            * -1,
        **DIVIDE**( [LY Shortage Rate Calculated] - [TY Shortage Rate Calculated] , [LY Shortage Rate Calculated] )
    )
)

View solution in original post

2 REPLIES 2
dedelman_clng
Community Champion
Community Champion

You have an extra IF towards the end.  Should be

 

% Change Calculated =
IF (
    [LY Shortage Rate Calculated] = 0,
    0,
    IF (
        [LY Shortage Rate Calculated] > 0,
        ( [LY Shortage Rate Calculated]
            - [TY Shortage Rate Calculated] / [LY Shortage Rate Calculated] )
            * -1,
        ( [LY Shortage Rate Calculated]  ##You had an extra IF here
            - [TY Shortage Rate Calculated] / [LY Shortage Rate Calculated] )
    )
)

Thanks for the quick reply Dedelman_clng! I added in some divides into the formula with your change and it worked perfectly. 

 

% Change Calculated =
IF (
    [LY Shortage Rate Calculated] = 0,
    0,
    IF (
        [LY Shortage Rate Calculated] > 0,
       **DIVIDE** ( [LY Shortage Rate Calculated]
            - [TY Shortage Rate Calculated] , [LY Shortage Rate Calculated] )
            * -1,
        **DIVIDE**( [LY Shortage Rate Calculated] - [TY Shortage Rate Calculated] , [LY Shortage Rate Calculated] )
    )
)

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.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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