Forum Discussion
Previous Row Value Dax
- 5 years ago
Hi Anonymous ,
Thanks for your provided details. Since Dax is calculated based on column value not row value, the last row in your picture cannot achieved if there is no continued date after 2020/1/31 because it add a new row in your dataset.
Basically the previous row measure will be like this:
Previous row value = CALCULATE ( [RunningSum], FILTER ( ALL ( 'Table' ), 'Table'[Date] = CALCULATE ( MAX ( 'Table'[Date] ), FILTER ( ALL ( 'Table' ), 'Table'[Date] < SELECTEDVALUE ( 'Table'[Date] ) ) ) ) )You will get the result in the table visual:
Attached a new sample file in the below, hopes to help you.
Best Regards,
Yingjie LiIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Hi v-yingjl ,
I have a value and RunningSum measure which I've created before as you can see below.
So i want to get Previous Row Value using RunningSum measure.
Hi Anonymous ,
Thanks for your provided details. Since Dax is calculated based on column value not row value, the last row in your picture cannot achieved if there is no continued date after 2020/1/31 because it add a new row in your dataset.
Basically the previous row measure will be like this:
Previous row value =
CALCULATE (
[RunningSum],
FILTER (
ALL ( 'Table' ),
'Table'[Date]
= CALCULATE (
MAX ( 'Table'[Date] ),
FILTER ( ALL ( 'Table' ), 'Table'[Date] < SELECTEDVALUE ( 'Table'[Date] ) )
)
)
)
You will get the result in the table visual:
Attached a new sample file in the below, hopes to help you.
Best Regards,
Yingjie Li
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.