Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Calculating 28day Rolling Average for Run Time

Hi,

 

I used this formula to calculate AVG run-time:

-------------------------------------------------------------------

AVG RunTime(secs) =
AVERAGEX( 'Run Time',
DATEDIFF('Run Time'[StartTime],'Run Time'[EndTime],SECOND)
)
---------------------------------------------------------------------
Key: StartTime and EndTime are a datetime fields
---------------------------------------------------------------------
 
I want to calculate a rolling 28 day AVG for run-time using a measure with CALCULATE and -28,DAY.
and then I want to drop the measure into a card to show this figure.
 
Please could I have some help to formulate a measure?
  • Anonymous , Join start or end date with the date of date table and try (Date without time stamp)

     

    Rolling 28 = CALCULATE(AVERAGEX( 'Run Time',
    DATEDIFF('Run Time'[StartTime],'Run Time'[EndTime],SECOND)
    ),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-28,DAY))

1 Reply

  • Anonymous , Join start or end date with the date of date table and try (Date without time stamp)

     

    Rolling 28 = CALCULATE(AVERAGEX( 'Run Time',
    DATEDIFF('Run Time'[StartTime],'Run Time'[EndTime],SECOND)
    ),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-28,DAY))