Forum Discussion

CoreyPOIA's avatar
CoreyPOIA
New Member
6 years ago
Solved

Weird Behavior in YOY analysis?

Hi PBI Gurus,

 

I'm requesting your help in trying to figure out some weird behavior of Power BI. 

 

Take a look at my screenshot. The top graph is displaying correct data. The following fields are being used:

Total Shipped Orders = DISTINCTCOUNT (Orders)

Axis is Month ( from date table )

Legend is Year ( from date table )

 

The bottom graph is showing incorrect data for THIS YEAR. ( It seems to be adding this year and last year together )

Total Shipped Orders LY = CALCULATE( [Total Shipped Orders] , SAMEPERIODLASTYEAR( [Date] ))

 

You can see the correct, verified values in the table below both graphs.

The reason this is causing me trouble, is because I want to display a bar chart below the top graph that is % difference from last year. However, because it is not calculating current year correctly, the % change is obviously different. 

 

My % change measure is, % Change = DIVIDE ( [Total Shipped Orders LY] - [Total Shipped Orders] , [Total Shipped Orders LY], 0 )

 

For example, June % change is showing me an INCREASE of 81%, when in actuality, it should be a DECREASE of -18.5%.

 

Any idea of why this is happening? Or more importantly, how to fix it?

 

Thank you so much!

 

  • Nevermind,

     

    I just fixed it. It looks like I just had to apply a YEAR filter set to 2019.

     

    Thanks for your help!

3 Replies

  • You seem to be using [Total Shipped Orders], which seems like a measure.

     

    Can you share its calculation? In case it is a measure, is possible to have the same calculation in last year's formula itself.

     

    Thanks

    • CoreyP's avatar
      CoreyP
      Icon for Solution Sage rankSolution Sage

      Yes, it is a measure, I thought I specified it's calculation in my OP. 

       

      Here are my measures.

       

      Total Shipped Orders = DISTINCTCOUNT( 'Orders'[Order Number] )

      Total Shipped Orders LY = CALCULATE( [Total Shipped Orders] , SAMEPERIODLASTYEAR( 'Date'[Date] ) )

      % Change from Last Year = DIVIDE( [Total Shipped Orders] - [Total Shipped Orders LY] , [Total Shipped Orders LY] , 0 ) 

       

      My dataset is only 2018/2019.

      • CoreyP's avatar
        CoreyP
        Icon for Solution Sage rankSolution Sage

        Nevermind,

         

        I just fixed it. It looks like I just had to apply a YEAR filter set to 2019.

         

        Thanks for your help!