Forum Discussion
duration format
- 4 years ago
Hi Anonymous ,
You can follow these steps to calcualte:
1. Change the data type of duration column to HH:MM:SS:
2. Create a calculate column to get the seconds:
Second = SECOND('Table'[Duration])3. Create a measure to calculate the average seconds:
Average = VAR _avg = AVERAGE ( 'Table'[Second] ) VAR HoursPart = MOD ( INT ( _avg / 3600 ), 24 ) VAR MinPart = MOD ( INT ( _avg / 60 ), 60 ) VAR SecPart = MOD ( _avg, 60 ) RETURN FORMAT ( CONVERT ( HoursPart & ":" & MinPart & ":" & SecPart, DATETIME ), "hh:mm:ss" )Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
You can follow these steps to calcualte:
1. Change the data type of duration column to HH:MM:SS:
2. Create a calculate column to get the seconds:
Second = SECOND('Table'[Duration])
3. Create a measure to calculate the average seconds:
Average =
VAR _avg =
AVERAGE ( 'Table'[Second] )
VAR HoursPart =
MOD ( INT ( _avg / 3600 ), 24 )
VAR MinPart =
MOD ( INT ( _avg / 60 ), 60 )
VAR SecPart =
MOD ( _avg, 60 )
RETURN
FORMAT (
CONVERT ( HoursPart & ":" & MinPart & ":" & SecPart, DATETIME ),
"hh:mm:ss"
)
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
What if i need to calculate the Duration in Minutes, Hours or all together?