Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Difference per cumulative amount

Hi,

 

 I calculate the difference saldo per month? I only have now the cumulative total saldo per month. This value increases.
Data

Thanks,

Leon

  • Hi Anonymous 

    Please check below formula to get last saldo.

    Column =
    CALCULATE (
        SUM ( Table1[Saldo] ),
        FILTER (
            Table1,
            Table1[Cat] = EARLIER ( Table1[Cat] )
                && Table1[Index]
                    = EARLIER ( Table1[Index] ) - 1
        )
    )
    

    Regards,

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    I have added also an index column, does this help?

    • v-cherch-msft's avatar
      v-cherch-msft
      Microsoft Employee

      Hi Anonymous 

      You may try to create a column like below to get the diff.For example:

      Diff =
      'Table'[saldo]
          - CALCULATE (
              SUM ( 'Table'[saldo] ),
              FILTER ( 'Table', 'Table'[index] = EARLIER ( 'Table'[index] ) - 1 )
          )
      

      Regards,

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Thanks this is a good start however the diff calculation should apply to a specific category condition for which I created a specific index

         

         CAT   Saldo   Index    

        CAT A;  50 ;    1

        CAT A;  100;   2
        CAT A;  200;   3  

        CAT B:     25;    1

        CAT B:      75;   2

        CAT B:    100;   3

         

        Thanks!