Forum Discussion

LUCASM's avatar
LUCASM
Icon for Helper IV rankHelper IV
6 years ago

calculate difference between two rows in a matrix

I am recreating a set of excel charts and tables into PowerBi (which may be my problem) 

I have a number of tables which I am building as Matrixes and am having trouble with summing the results

 

Each matrix is quite small the columns ranging from April to March (as the financial Year)

and the rows are 2 for example 2018, 2019

the values are then a sum of the sales

 

What I am in need of help with is creating a 3rd row which for example gives the difference by subtracting September from August

and a 4th row which for example gives the %difference by dividing September from August - 1

 

Example of  Excel Table I am trying to replicate

 

Any help gratefully received

 

 

11 Replies

  • I should have added my Power Bi side

    Products.Year

    Products.Type

    Calendar.PeriodMonth

    Products.Units

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi LUCASM ,

      You can consider adding measure formula with if statements to replace your value field.

      Measure =
      CALCULATE (
          CALCULATE ( SUM ( Table[Amount] ), Table[Type] = "Forecast(Sep)" )
              - CALCULATE ( SUM ( Table[Amount] ), Table[Type] = "Forecast(Aug)" ),
          ALLSELECTED ( Table ),
          VALUES ( Table[FisalDate] ),
          VALUES ( Table[Date] )
      )
      

      If above not help, please share some sample data for test.

      Regards,

      Xiaoxin Sheng

      • LUCASM's avatar
        LUCASM
        Icon for Helper IV rankHelper IV

        Hi Anonymous 

         

        This doesn't work for my needs

        I have added a pibx file for anyone who is looking to assist me here

         

        Kind Regards and thanks

         

         test file