Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

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...
  • amitchandak's avatar
    2 years ago

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