Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
RENJITH_R_S
Resolver II
Resolver II

difference 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             175           25

p4             225           50

p5             300           75

3 ACCEPTED SOLUTIONS
Ritaf1983
Super User
Super User

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)))
Ritaf1983_0-1687003478594.png

Link to a Sample file 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

Ahmedx
Super User
Super User

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)))

View solution in original post

4 REPLIES 4
Ahmedx
Super User
Super User

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)))

@Ahmedx Thanks

Ritaf1983
Super User
Super User

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)))
Ritaf1983_0-1687003478594.png

Link to a Sample file 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Thank You @Ritaf1983

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors