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
TBSST
Frequent Visitor

Combining Hours and Minutes then Averaging

Hi All, 

 

I am trying to find the average of time spent when doing surveys. 

 

The hours and minutes spent are in different columns. 

 

I cant seem to find how to combine the times together then find the average time spent umong the surveys. 

 

Any help will be greatly appreciated. 

 

Thank you. 

1 ACCEPTED SOLUTION
v-tianyich-msft
Community Support
Community Support

Hi @TBSST ,

 

Based on your description, I created the simple sample, you may check the result:

vtianyichmsft_0-1697785415094.png

 

An attachment for your reference. Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

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

View solution in original post

3 REPLIES 3
v-tianyich-msft
Community Support
Community Support

Hi @TBSST ,

 

Based on your description, I created the simple sample, you may check the result:

vtianyichmsft_0-1697785415094.png

 

An attachment for your reference. Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

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

123abc
Community Champion
Community Champion

To find the average time spent on surveys in Power BI when the hours and minutes are in different columns, you can follow these steps:

Assuming you have two columns named "Hours" and "Minutes" to represent the time spent on surveys, you can combine them into a single column and then calculate the average. Here's how you can do it:

  1. Combine Hours and Minutes into a Single Column: You can create a custom column that combines the hours and minutes into a single time duration column. You can use the Power Query Editor to do this. Follow these steps:

    • Open Power BI Desktop.
    • Go to "Home" > "Edit Queries" to open the Power Query Editor.
    • Select the table containing your survey data.
    • Go to the "Add Column" tab and select "Custom Column."

    In the "Custom Column" dialog, use a formula like this to combine hours and minutes:

Duration.From([Hours] & ":" & [Minutes])

 

  1. This will create a new column that combines the hours and minutes into a time duration.

  2. Calculate the Average Time: After you've combined the hours and minutes into a single column, you can now calculate the average time spent. Here's how:

    • Close the Power Query Editor, and you'll see the new combined column in your data table.
    • Create a new measure to calculate the average duration. Go to the "Modeling" tab and select "New Measure."
    • In the formula bar for the new measure, use the AVERAGE function to calculate the average duration:

Average Duration = AVERAGE('YourTableName'[CombinedTimeColumn])

 

 

  1. Replace 'YourTableName' with the name of your data table and 'CombinedTimeColumn' with the name of the column where you combined hours and minutes.

Now you have a measure called "Average Duration" that gives you the average time spent on surveys. You can add this measure to your visuals and reports to display the average time.

Make sure that the "CombinedTimeColumn" in your model is set as a duration data type so that the AVERAGE function can calculate the average correctly.

 

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

 

In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.

vicky_
Super User
Super User

Is there any chance that you can create a column and do all your calculations in minutes? 
When you get the result that you want (in minutes), you can then adapt one of these to format as hh:mm:

https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Chelsie-Eiden-s-Duration/m-p/793639...

https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Duration-to-Seconds-Converter/m-p/3...

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.