Forum Discussion
RENJITH_R_S
Resolver II
3 years agodifference from previous row in a measure
Hi friends, Can you help me to write a measure to acheive the Result Sample Data Period Value Result p1 100 100 p2 150 50 p3 ...
- 3 years ago
Hi RENJITH_R_S
You can achieve your goal, using the offset function.1. Create a basic sum measure:
SumValue = sum('Table'[Value])2. Use it on your offset calculation measure:ValuesDiff = [SumValue]-CALCULATE([SumValue],OFFSET(-1,ALLSELECTED('Table'[Period]),ORDERBY('Table'[Period],ASC)))If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
- 3 years ago
if you use a slicer or you have spaces in the date, it's better to write the measure like this
CALCULATE( [SumValue], OFFSET(-1, SUMMARIZE(ALLSELECTED('Table'),'Table'[Period]),ORDERBY('Table'[Period],ASC))) - 3 years agoThank You Ritaf1983
Ahmedx
Super User
3 years agoif you use a slicer or you have spaces in the date, it's better to write the measure like this
CALCULATE(
[SumValue],
OFFSET(-1,
SUMMARIZE(ALLSELECTED('Table'),'Table'[Period]),ORDERBY('Table'[Period],ASC)))- RENJITH_R_S3 years ago
Resolver II
Ahmedx Thanks