Forum Discussion

Aruna_ln's avatar
Aruna_ln
Helper III
9 years ago
Solved

I need previous values- currentvalues same column

hello everybody,   i have table amount    cumilative   diff 2                   2               3    3                    5              1 1                   6               7 7              ...
  • v-caliao-msft's avatar
    9 years ago

    Aruna_ln,

     

    In Power BI desktop data model,  there are no orders for the records in your dataset. If you want to get previous value and calculated the different, you should have a order column. Please refer to the steps below to see the details.

    1. Edit your query>Add Column>Index Column>From 1
    2. Cumilative column
      Cumilative = CALCULATE(SUM(Table1[Amount]),FILTER(Table1,Table1[Index]<=EARLIER(Table1[Index])))
    3. Diff = Table1[Amount]-LOOKUPVALUE(Table1[Amount],Table1[Index],Table1[Index]-1)

    Regards,

    Charlie Liao