Forum Discussion
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 13
my table i have 2 column amount and cumulative
but i need diffrent previous values-current value
anybody help me.
thanks
aruna
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.
- Edit your query>Add Column>Index Column>From 1
- Cumilative column
Cumilative = CALCULATE(SUM(Table1[Amount]),FILTER(Table1,Table1[Index]<=EARLIER(Table1[Index]))) - Diff = Table1[Amount]-LOOKUPVALUE(Table1[Amount],Table1[Index],Table1[Index]-1)
Regards,
Charlie Liao
- Edit your query>Add Column>Index Column>From 1
1 Reply
- v-caliao-msftMicrosoft Employee
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.
- Edit your query>Add Column>Index Column>From 1
- Cumilative column
Cumilative = CALCULATE(SUM(Table1[Amount]),FILTER(Table1,Table1[Index]<=EARLIER(Table1[Index]))) - Diff = Table1[Amount]-LOOKUPVALUE(Table1[Amount],Table1[Index],Table1[Index]-1)
Regards,
Charlie Liao
- Edit your query>Add Column>Index Column>From 1