Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

How to do calculations at row level using Dax Measures

I want to calculate variance or do some other calculations at the row level. Mainly using Dax Measures.

How to do it?

 

Please help

  • Hi Anonymous ,

     

    If you want to calculate the difference between the next row data and the current row data, we can create two calculate columns to meet your requirement.

     

    1. Create an index column in Power Query Editor.

     

     

    2. Then we can create two calculate columns,

     

    Variance No.s = 
    CALCULATE(SUM('Table'[Data]),FILTER('Table','Table'[Index]>EARLIER('Table'[Index]))) - 'Table'[Data]

     

    Variance % = 
    var _next_row = CALCULATE(SUM('Table'[Data]),FILTER('Table','Table'[Index]>EARLIER('Table'[Index])))
    return
    DIVIDE('Table'[Variance No.s],_next_row)

     

     

    If it doesn't meet your requirement, could you please show the exact expected result based on the table that you have shared?

    BTW, pbix as attached.

     

    Best regards,

     

    Community Support Team _ zhenbw

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

6 Replies