Forum Discussion
Eckhardt_david
2 years agoFrequent Visitor
Get value from previous row
Hi!
I'm looking for a way to get a value from a previous row.
So in the example below Row 103 should look in Row 102 and get the value (129) from 'Cumul Backlog'.
I added the index/row because the timestamps are not continuous due to weekends and I thought it would be possible to refer to the current row -1 that way, but I am unable to retrieve the value.
How can I best approach this?
Thanks already for the help!
This would be the desired result:
| Row | Previous Row | Ship Date | #Orders to Ship | # Orders Shipped | Cumul Backlog | New Measure |
| 103 | 102 | 8/09/2023 | 665 | 577 | 217 | 129 |
| 102 | 101 | 7/09/2023 | 785 | 957 | 129 | 301 |
| 101 | 100 | 6/09/2023 | 743 | 535 | 301 | 93 |
| 100 | 99 | 5/09/2023 | 692 | 853 | 93 | 254 |
Eckhardt_david , you can try something like this:
prev_value = CALCULATE ( MAX ( Table[Cumul_Backlog] ), TOPN ( 1, FILTER ( ALLSELECTED ( Table ), Table[Row] < MAX ( Table[Row] ) ), Table[Row] ) )
2 Replies
- ERD
Community Champion
Eckhardt_david , you can try something like this:
prev_value = CALCULATE ( MAX ( Table[Cumul_Backlog] ), TOPN ( 1, FILTER ( ALLSELECTED ( Table ), Table[Row] < MAX ( Table[Row] ) ), Table[Row] ) ) - ThxAlot
Super User