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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Derive value from previous recorded reading for specific ident

I would like to create a column that calculates the a value for the ammount of time run between two dates.

IE: (Total run time for ident aa19 on 09/01/2023) - (Total run time for ident aa19 on 02/01/2023)

 

I cannot get a figure which filters for both the required ident and the previous date recorded.

 

Any help appreciated.

 

Capture DateIdentTotal run timerun time since last capture
02/01/2023aa193332 
02/01/2023aa972033 
02/01/2023ab2113900 
02/01/2023ab203655 
09/01/2023aa193333 
09/01/2023aa972033 
09/01/2023ab2113907 
09/01/2023ab203655 
16/01/2023aa193335 
16/01/2023aa972048 
16/01/2023ab2113920 
16/01/2023ab203655 
23/01/2023aa193347 
23/01/2023aa972050 
23/01/2023ab2113929 
23/01/2023ab203659 
30/01/2023aa193352 
30/01/2023aa972050 
30/01/2023ab2113937 
30/01/2023ab203667 
06/02/2023aa193358 
06/02/2023aa972050 
06/02/2023ab2113951 
06/02/2023ab203673 
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , if you need a new column

 

diff with Last Run =

_last = Maxx(filter(Table, [Ident] = earlier([Ident]) && [Capture Date] < earlier([Capture Date]) ),[Capture Date])

return

_last - Maxx(filter(Table, [Ident] = earlier([Ident]) && [Capture Date] = _last ),[Total Run])

 

 

if total run is measure then you need a measure

 

Diff Measure= [Total Run] - calculate([Total Run], OFFSET(-1, ALLSELECTED('Table'[Ident],'Table'[Capture Date]), ORDERBY('Table'[Capture Date],asc),KEEP,PARTITIONBY('Table'[Ident])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

That worked great,

Thank you very much 👍

amitchandak
Super User
Super User

@Anonymous , if you need a new column

 

diff with Last Run =

_last = Maxx(filter(Table, [Ident] = earlier([Ident]) && [Capture Date] < earlier([Capture Date]) ),[Capture Date])

return

_last - Maxx(filter(Table, [Ident] = earlier([Ident]) && [Capture Date] = _last ),[Total Run])

 

 

if total run is measure then you need a measure

 

Diff Measure= [Total Run] - calculate([Total Run], OFFSET(-1, ALLSELECTED('Table'[Ident],'Table'[Capture Date]), ORDERBY('Table'[Capture Date],asc),KEEP,PARTITIONBY('Table'[Ident])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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 Kudoed Authors