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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
wcameron14
Frequent Visitor

Duration Displayed on Card

Hello,

 

I am working with Google Analytics data and attempting to display a card with the Average Session Duration. I have created a custom column to display this data on my table in Power Query with the following formula:

 

= Table.AddColumn(#"Changed Type", "Average Session Duration", each [Session Duration] / [Sessions])

 

 I know from viewing GA that the outcome I'm looking for is 0:01:17. From working with the data in Excel, I know that I can get the right answer with the following equation: Sum(Session Duration) / Sum(Sessions).

Excel Extract.PNG

When I go to display this value on a card, it shows as a decimal.

As time. Only Summarization options are "Don't Summarize" and "Count"As time. Only Summarization options are "Don't Summarize" and "Count"

I changed the Data Type to "Time" to get to the format but I can only Summarize the data with "Count" or "Don't Summarize", neither of which give me the average that I'm looking for.

As a decimal numberAs a decimal number

 My calculation may be wrong but I can't tell based on the output that I'm getting. Any thoughts on how to get to the right number and display?

1 ACCEPTED SOLUTION

What you could do is create a calculated column:

 

averagepersessioncol = 'Table'[Total Session Duration]/'Table'[Sessions]

 

And a measure:

 

durationpersession = Format(AVERAGE('Table'[averagepersessioncol]); "HH:MM:SS")

 

For the 3rd and 4rth row this yields:

time.png

Which is the average of averages.. like here in excel:

time2.png

 

Link to Power BI file here

 

please mark as solution if this works for you.

 

Kind regards, Steve. 

View solution in original post

9 REPLIES 9
harshnathani
Community Champion
Community Champion

Hi @wcameron14 ,

 

 

You can try the following measure

 

Display =

var TSD = CALCULATE(Sum('Table'[Total Session Duration]),ALLSELECTED('Table'[Date]))
Var Sess = CALCULATE(Sum('Table'[Total Session]),ALLSELECTED('Table'[Date]))

RETURN
DIVIDE (TSD,Sess)
 
Regards,
Harsh Nathani

This still displays a decimal on the card. Maybe there's something I'm doing wrong with the formatting of my visual?

What you could do is create a calculated column:

 

averagepersessioncol = 'Table'[Total Session Duration]/'Table'[Sessions]

 

And a measure:

 

durationpersession = Format(AVERAGE('Table'[averagepersessioncol]); "HH:MM:SS")

 

For the 3rd and 4rth row this yields:

time.png

Which is the average of averages.. like here in excel:

time2.png

 

Link to Power BI file here

 

please mark as solution if this works for you.

 

Kind regards, Steve. 

This helped with the formatting. My formula isn't quite right but I think I can figure it out from there. Thanks for the help!

@stevedep I went back and added pictures to the post to make it a little easier to understand. 

Thanks, that's helpful. How is the session duration stored in your dataset? Is it a duration in seconds or minutes (sum of)?

It is stored as a duration in the dataset. D.hh:mm:ss.0 (See below).

duration data.PNG

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.