Forum Discussion
Calculate Average time
Hi SRK_23
I'm not sure I fully understand what you need but wouldn't the following be sufficient?
1. Set PlatfomEntityName in the rows of a matrix visual
2. Set in values of the matrix a measure similar to:
AverageSessionTime = AVERAGE(Table1[Duration_Calc])
I tryied but the resultat is not correct, could you please have a look to the doc attached here: https://uptobox.com/1k2100scf5z0
Thanks,
- v-piga-msft7 years agoResident Rockstar
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
- AlB7 years agoCommunity Champion
Hi SRK_23
I see that v-piga-msft might have already given you a solution but since I'd already had a look at your file, I'll post mine too. Just in case it can be of help.
With the table structure and the columns that you currently have, I would place PlatformEntityName (and potentially SessionId under it, if you need it) and place the below measure in values. It will give you the average duration in minutes. You can change to Mins-Secs format from that if needed.
AverageSessionTime = AVERAGEX ( VALUES ( dm_pageview_company[Duration_Calc] ); dm_pageview_company[Duration_Calc] ) *24*60 - SRK_237 years agoHelper I
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: