Forum Discussion
lisaburton
3 years agoFrequent Visitor
average time function
I am trying to gain an average 'tip time' of a lorry for last week and yesterday. I can't seem to be able to select the average the usual way, i only have the option to select the 'fastest' and 'ear...
Anonymous
3 years agoNot applicable
In PowerQuery, Duplicate the time column and convert the data type to Decimal.
Let's say your new column is "TimeFieldinDecimal"
DAX:
Avg Time (Time) =
var _duration = Avg(TimeFieldinDecimal)
var _hrs = _duration * 24
var _mins = (_hrs - int(_hrs)) * 60
var _sec = (_mins - int(_mins)) * 60
return FORMAT(int(_hrs), "#00") & ":" & FORMAT(int(_mins), "#00") & ":" & FORMAT(int(_sec), "#00")