Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Calculating Difference between Two Days based on a variable

Good Day   I need assistance with adding a Calulcated Column to my Database.   I need worked hours to take the SMR (Hour Meter) from the day it is recorded and subtract it from the SMR of that "s...
  • v-chenwuz-msft's avatar
    v-chenwuz-msft
    4 years ago

    Hi Anonymous ,

     

    You can use VAR to improve preformance.

    Previous SMR =
    VAR _t =
        TOPN (
            1,
            FILTER (
                DailyProduction,
                DailyProduction[EIID] = EARLIER ( DailyProduction[EIID] )
                    && DailyProduction[SMR] < EARLIER ( DailyProduction[SMR] )
            ),
            [Date], DESC
        )
    RETURN
        MAXX ( _t, [SMR] )
    

     

     

    Best Regards

    Community Support Team _ chenwu zhu

     

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