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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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

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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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