Forum Discussion

Chirantan's avatar
Chirantan
Frequent Visitor
8 years ago
Solved

Subtract rows in a Table based on a id

Hi I have a table as follows:   And I would like to achieve something like this:     I am trying to subtract rows based in the Attribute/indx, which in turn is trying to find the dif...
  • v-yuta-msft's avatar
    v-yuta-msft
    8 years ago

    Hi Chirantan,

     

    To achieve your requirement, you can create a calculate column as below:

    Calculation = 
    VAR First_Value = Table1[Value]
    VAR First_Index = Table1[Index]
    VAR Last_Value = CALCULATE(MAX(Table1[Value]), FILTER(Table1, Table1[Index] = First_Index + 4))
    RETURN
    IF(Last_Value = 0, 0, Last_Value - First_Value)

     

     

    Regards,

    Jimmy Tao