I'm pulling in Google Analytics data and attempting to create a formula to calculate average session duration (total session duration/sessions).
The issue that I'm running into is when summing my "total session duration" date field. The HH:mm:ss format works up until the hour parameter hits 24 (as the setting for HH is a 24-hour clock). Is there a way to get around this 24-hour restriction? Should I be using a different format?
I suggest splitting that time field into 3 separate columns for hours, mins and seconds (do this by expand value operation on the ":") then creating a new field that is the summation of the time in just seconds where it is:
[Total Time (s)] = [Seconds] + 60*[Minutes] + 3600*[Hours]
The total time in this case would be an integer and not a date/time.
Then for average session duration it would just be [Total Time (s)]/[Sessions] To get minutes just divide that by 60 and for hours by 3600.
If you want to do it in just one single field the formula* is a bit long but would look like:
Then divide that by [Sessions] and 60 for mins and 3600 for hours.
Most likely your session durations would be in the seconds or minutes at most, not hours.
*Just an addendum for the second formula, if you use left or right functions you have to make sure your time/session duration field is always defaulted to text. The numvalue() will change the individual subtext into a numerical format for your output.
This should give a text output format in terms of minutes:seconds, just create a new field where duration is the time duration in seconds of the previous formula.