Forum Discussion

sudhakar111's avatar
sudhakar111
Helper IV
9 years ago
Solved

Difference % in Cross Tab

Hi Everyone,

 

I have a croos tab report in the below format. Years are the rows and Months are the columns.

 

Need to show Quantity and Difference %. Difference % = (Quantity (Current Year)-Quantity(Previous Year)/Quantity (Previous

 

Year)). The Problem i am facing is there is one field quantity and it has to be split for curent year and previous year in the

 

difference % calculation.

 

10 Replies

  • Hey,

     

    here you will find a pbix file

     

    On the report page "YOY" there you will find a Matrix visual showing the growth over the years.

     

    This is the DAX script that calculates the measure

    YOY Growth = 
      DIVIDE(
    (CALCULATE(SUM(FactWithDates[Amount]))
    -CALCULATE(SUM(FactWithDates[Amount]),DATEADD('Calendar'[Date],-1,YEAR)))
    ,(CALCULATE(SUM(FactWithDates[Amount]),DATEADD('Calendar'[Date],-1,YEAR))),BLANK())*100

    Hope this helps

     

    • sudhakar111's avatar
      sudhakar111
      Helper IV

      Thanks a lot. I checked the PBIX file but could not find the matrix visual.

       

      Tried the formula in my report.

       

      The below part of the formula is giving an error.

       

      YOY Growth =
      (CALCULATE(SUM(Sales_1[BILLED_QTY])-CALCULATE(SUM(Sales_1[BILLED_QTY]),DATEADD('Sales_1'[INV_BILLING_DATE],-1,YEAR)))
      )

      • TomMartens's avatar
        TomMartens
        Super User

        Hmm,

         

        this is odd, just downloaded the mentioned file and there is a report page

         

        and on this page there is the matrix visual I mentioned above, please re-download and check again.

         

        Your Formula looks not the same as mine, can you please provide the error Message and also easily reproducible sample data, without these information it is very hard or impossible to figure out what's going wrong on your side.

         

        Regards