Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

(Yet another) time query

Hello all

 

I've recently linked Power BI to Google Analytics, and my customer wants to focus on Average Time on the Page.

 

 

The data is brought into the model in a 'Duration' format, and looks like this (I'll upload a screenshot too) : 0.00:00:03.6666667

AveTime.PNG

 

 

Of course there are many different number combinations, but the format is always the same.

 

I need to convert it to either a TIME format that I can use in mathematical calculations, or preferably convert it to SECONDS and then work out an average from that.

 

So, firstly, how can I convert the above to SECONDS please (If possible in the Query Editor, as I have tried converting it to TIME in the 'Modelling' tab and any SECOND calculations I run all seem to be a second out.AveTime2.PNG

AveTime3.PNG

 

 

 

 

 

Secondly, is there a way to run an accurate average on this metric, as of course a mathematical average gives me one answer (for example Average Time on Page = 36 seconds), but when I run a corresponding report on GA it gives me Average Time on Page = 41 seconds.

 

I hope that makes sense, as I've read what seems like a million posts on here around TIME, but I can't find a solution that works for me.

 

Any help you can give me is much apreciated.

 

Kind Regards

 

Daniel

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I think I've solved it myself!

 

I was asking for daily data, and Power BI was trying to average, but by removing day from my query, it is retuening the expected results.

 

Thanks for your help!

 

 

View solution in original post

6 REPLIES 6
vivran22
Community Champion
Community Champion

@Anonymous 

 

Hi,

 

If the column is loading as duration and you need to convert it as total seconds then use following:

 

Transform or Add Column > Duration (Under Date & Time segment) > Total Seconds

 

It will convert the existing duration column in seconds.

 

I am not sure about your second requirement because as per my experience, average calculation in Power BI gives accurate results. I would recommend you to calcualte average after performing the steps above.

 

Rgds,

Vivek

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi vivran

 

As the screenshot will show, I have explored the Time functions under transforming columns, and I cannot see find a seconds option:

 

AveTime4.PNG

 

What I did find though was the 'Duration' button lit, and that gives an option to split out seconds from the duration, and, although it doesn't deal with milliseconds, this may move me further forward.

 

Thanks for taking the time to reply

 

Daniel

 

 

@Anonymous 

 

Hi,

 

Forgot to mention: The option I have suggested is available in Power Query and not in Power BI. You need to open the table in the Edit Query mode to access the feature.

 

Rgds,

Vivek

Anonymous
Not applicable

Thanks Vivran

 

So the Duration button has given me the seconds I need, however, I'm now trying to replicate the Average Time on Page and Bounce Rate metrics from Google Analytics.

 

When I put my measures in a table I see the following:

AveTime5.PNG

However , the totals are different (in some cases as much as 5%) from those that Google Analytics are reporting.

As you can see from the table, I've tried weighting the average to minimise the difference, however it is still enough to render the table completely innaccurate to it's audience.

 

Is there a calculation method I'm missing to get this closer to the mark?

 

Daniel

Hi,

What is the calculation of average and is it possible to share the sample data and the expected results from google analytics?

Rgds,
Vivek
Anonymous
Not applicable

I think I've solved it myself!

 

I was asking for daily data, and Power BI was trying to average, but by removing day from my query, it is retuening the expected results.

 

Thanks for your help!

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors