Forum Discussion
Calculate Average time
Hi SRK_23,
What about converting your calculated column Duration_Calc to be seconds and then calculate the average?
You could convert the calculated column Duration_Calc to be seconds with the formula below.
seconds =
HOUR ( 'dm_pageview_company'[Duration_Calc] ) * 360
+ MINUTE ( 'dm_pageview_company'[Duration_Calc] ) * 60
+ SECOND ( 'dm_pageview_company'[Duration_Calc] )
Measure = AVERAGE(dm_pageview_company[seconds])
After you calculate the average of the sceonds, you could convert the seconds to the hh:mm:ss format with the formula below.
average_hhmmss=
INT ( 'dm_pageview_company'[Measure] / 3600 )
& ":"
& RIGHT (
"0"
& INT (
(
'dm_pageview_company'[Measure]
- INT ( 'dm_pageview_company'[Measure] / 3600 )
* 3600
)
/ 60
),
2
)
& ":"
& RIGHT ( "0" & MOD ( 'dm_pageview_company'[Measure], 3600 ), 2 )
Best Regards,
Cherry
Should I tipe the code like this in a measure ? Because the measure is not recognized and it doesn't work. Sorry i'm quite new with those calculations.
I put the file here:
- AlB7 years agoCommunity Champion
- SRK_237 years agoHelper I
Hi AlB , I did your calculation here and the average seems wrong, or maybe I don't understand something. In the example attached, we have a session length at 2 minutes 22 secondes, and the average on the session is 2.37 in your calculation; the average should be 2:22 as well (as we focuse on only one session). Do you know what I mean ?
(File attached)