Forum Discussion

amarinoRB's avatar
amarinoRB
Frequent Visitor
2 years ago
Solved

YoY % change not working properly..

I have input a formula for YoY percent change (picture 1 below) and it is working as intended with the revenue, but not for the other categories where I simply copied the formula and changed the measures (picture 2). It is showing YoY% changes when there is no input for this years values. Anyone have insight to how I can resolve this?

 

 

  • Anand24's avatar
    Anand24
    2 years ago

    amarinoRB ,
    Try this:

     

    YoY % Change (Revenue) =
    VAR LastYearRevenue = CALCULATE ( [Revenue YTD], SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
    VAR Chg = DIVIDE ( [Revenue YTD] - LastYearRevenue, LastYearRevenue )
    RETURN
    IF (
    LastYearRevenue = BLANK () || Chg = -1,
    BLANK (),
    DIVIDE ( [Revenue YTD] - LastYearRevenue, LastYearRevenue )
    )

     

     

    Give a Thumbs Up if this post helped you in any way and Mark This Post as Solution if it solved your query !!!

    Proud To Be a Super User !!!
    LinkedIn

6 Replies

  • Hi amarinoRB ,
    Try adding if statment to your RETURN statement:
    IF(LastYearRevenue = BLANK(), BLANK(), DIVIDE([Revenue YTD] - LastYearRevenue , LastYearRevenue))

     

    Give a Thumbs Up if this post helped you in any way and Mark This Post as Solution if it solved your query !!!

    Proud To Be a Super User !!!
    LinkedIn



    • amarinoRB's avatar
      amarinoRB
      Frequent Visitor

      Hello Anand24, 
      Thank you for the quick reply, but unfortunately this did not solve the issue. There currently is no data for Q4 for either of the further 2 columns, and the revenue is displaying how I would expect it to (-100%). Any other other suggestions?

      • Anand24's avatar
        Anand24
        Icon for Super User rankSuper User

        amarinoRB ,
        Try this:

         

        YoY % Change (Revenue) =
        VAR LastYearRevenue = CALCULATE ( [Revenue YTD], SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
        VAR Chg = DIVIDE ( [Revenue YTD] - LastYearRevenue, LastYearRevenue )
        RETURN
        IF (
        LastYearRevenue = BLANK () || Chg = -1,
        BLANK (),
        DIVIDE ( [Revenue YTD] - LastYearRevenue, LastYearRevenue )
        )

         

         

        Give a Thumbs Up if this post helped you in any way and Mark This Post as Solution if it solved your query !!!

        Proud To Be a Super User !!!
        LinkedIn

  • Uzi2019's avatar
    Uzi2019
    Icon for Community Champion rankCommunity Champion

    Hi amarinoRB 
    You can try below measure for YOY%

    % Units =
    VAR Prev = CALCULATE(SUM(Table[Units]),DATEADD('Calendar'[Date],-1,YEAR))
    VAR Curr = CALCULATE(SUM(WOW[Units]),DATEADD(''Calendar'[Date],0,YEAR))
    RETURN DIVIDE(Curr-Prev,Prev,0)
     
    I hope this formula works for you.