Forum Discussion
SSS
8 years agoHelper I
Difference between two rows
Hi, I need help in order to solve a problem trying to calculate the differences between two rows in Power BI. My tables look like: Date Orders Index 01/01/2017 85...
- 8 years ago
Hi SSS
Using DAX you can add this calculated column to get desired results
= VAR NextIndex = Table1[Index] + 1 RETURN Table1[Orders] - CALCULATE ( VALUES ( Table1[Orders] ), FILTER ( ALL ( Table1 ), Table1[Index] = NextIndex ) )
Ashish_Mathur
5 years agoSuper User
Hi,
You should have a Calendar Table with a relationship from the Date column of your Data Table to the Date column of your Calendar Table. To your visual, drag the Date column from the Calendar Table. Write these measures:
Quantity = sum(Data[Number])
Quantity on previous day = calculate([quantity],previousday(calendar[date]))
Diff in quantity = [quantity]-[Quantity on previous day]
Hope this helps.
Rathan
5 years agoFrequent Visitor
Thank you. It worked
- Ashish_Mathur5 years agoSuper User
You are welcome. If my reply helped, please mark it as Answer.