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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Calculate an average time based on different users

Hello,

 

So I'm fairly new to Power BI and I'm still trying to learn the ropes. What I'm trying to do is basically calculate a user's average time overall. I'll make a a mock table as an example.

 

User PickingPickIDAverage Pick Time Orderline 
USER10000100:00:35
USER10000200:01:42
USER10000300:00:43
USER20000400:05:27
USER20000500:00:37
USER30000600:03:13
USER30000700:00:33
USER40000800:00:57
USER40000900:01:01

 

I know that the average times per user in order are 00:01:00, 00:03:02, 00:01:48, and 00:00:59. I want to add a fourth column with these values per user.

 

I know how I could do that in Excel, which is where this data is being taken from, but I'd like to learn how to do it in Power BI. Thank you!

 

Edit: I created a measure to trying to do this based off a similar thread like mine but it didn't work. 

 

Measure = AVERAGEX(SUMMARIZE(Table1, Table1[USER_PICKING], Table1[AVERAGE_PICK_TIME_ORDERLINE]), Table1[AVERAGE_PICK_TIME_ORDERLINE])

 

The error I got was  

"Couldn't load the data for this visual

 

MdxScript(Model) (4, 117) Calculation error in measure 'Table1'[Measure]: The function AVERAGEX cannot work with value of type String."

 

1 ACCEPTED SOLUTION

Create 3 new COLUMNS (not Measures) - Or you can try to Push these all together using VARS, but I like to keep it simple.  You'll need to do Modeling-> Formatting to get things back into Date/Time HH:MM:SS formats, but this is the general idea...  And make sure everything is set to 'Don't Summarize'.
FOrrest
 
Total Seconds = (HOUR(Table1[Pick Time]) * 3600) + (MINUTE(Table1[Pick Time]) * 60) + (SECOND(Table1[Pick Time]))
Average Column = CALCULATE(AVERAGE(Table1[Total Seconds]), ALLEXCEPT(Table1, Table1[User Picking]))
Average Time = TIME(0,0,Table1[Average Column])

 

image.png

 




Did I answer your question, or help you along the way?
Please give Kudos or Mark as a Solution!


https://www.linkedin.com/in/forrest-hill-04480730/

Proud to give back to the community!
Thank You!




View solution in original post

6 REPLIES 6
Manner_Valdez
Regular Visitor

Power Bi works very similar to excel, if in excel your cell format is Text you will not be able to make calculations of any type with values

Before making the formulas make sure that your times are in "Time, Date, or Datetime"

Otherwise convert the column type or pass the function to convert them before calculating with the data

amitchandak
Super User
Super User

Make sure it is detected as time and then refer

:

https://community.powerbi.com/t5/Desktop/Need-to-calculate-average-of-time-column/td-p/224112

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

So I was able to convert the AVERAGE_PICK_TIME_ORDERLINE times to seconds, but when I enter the measure in my OP the new column is just a repeat of the previous column.

 

I essentially want the fourth column

 

User PickingPickIDAverage Pick Time Orderline Average Pick Time User
USER10000100:00:3500:01:00
USER10000200:01:4200:01:00
USER10000300:00:4300:01:00
USER20000400:05:2700:03:02
USER20000500:00:3700:03:02
USER30000600:03:1300:01:48
USER30000700:00:3300:01:48
USER40000800:00:5700:00:59
USER40000900:01:0100:00:59

 

 

 

Create 3 new COLUMNS (not Measures) - Or you can try to Push these all together using VARS, but I like to keep it simple.  You'll need to do Modeling-> Formatting to get things back into Date/Time HH:MM:SS formats, but this is the general idea...  And make sure everything is set to 'Don't Summarize'.
FOrrest
 
Total Seconds = (HOUR(Table1[Pick Time]) * 3600) + (MINUTE(Table1[Pick Time]) * 60) + (SECOND(Table1[Pick Time]))
Average Column = CALCULATE(AVERAGE(Table1[Total Seconds]), ALLEXCEPT(Table1, Table1[User Picking]))
Average Time = TIME(0,0,Table1[Average Column])

 

image.png

 




Did I answer your question, or help you along the way?
Please give Kudos or Mark as a Solution!


https://www.linkedin.com/in/forrest-hill-04480730/

Proud to give back to the community!
Thank You!




Anonymous
Not applicable

Thank you!

 

The only issue I ran into afterwrads was that it took the value as a time and not a duration (12:01:30 A.M vs 1 minute 30 seconds)

 

But the math works out!

 

Yes, I diffently had to do some Data Formatting to make things look right, even though some things were Date/Times in reality.

 

FOrrest

 




Did I answer your question, or help you along the way?
Please give Kudos or Mark as a Solution!


https://www.linkedin.com/in/forrest-hill-04480730/

Proud to give back to the community!
Thank You!




Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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