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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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

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

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.