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

Sum Hours with a Group By date in a Column/Measure

Hi all,

 

I am trying to create a column/measure that takes a count of orders and divides it by the hours worked by an employee on a given day to get the average order per hour. In the query, I am joining the hours per day on each order, so I think PowerBI is summing those up when I need it to group by date when actually manipulating the data. I cannot aggregate and group by in the query or I lose the ability to export detailed information in PowerBI on each order.

 

Here is a fake data set of the relevant columns:

OrderEmployeeDateHours
1James6/16/20185
2James6/16/20185
3James6/16/20185
4James6/17/20186.2
5James6/17/20186.2
6James6/17/20186.2
7James6/17/20186.2
8James6/15/20182
9James6/15/20182
10James6/15/20182
11Sue6/1/20184
12Sue6/1/20184
13Sue6/1/20184
14Sue6/1/20184
15Sue6/3/20183
16Sue6/4/20182
17Sue6/5/20188
18Sue6/15/20184
19Sue6/15/20184
20Sue6/15/20184

 

Here is a table with what is returning in PowerBI and what I want it to show instead:

EmployeeOrdersHours (WRONG)Avg per Hour (WRONG)Hours (Wanted)Avg per Hour (WANTED)
James10045.82.18340611413.27.575758
Sue60411.463414634212.857143

 

Here is the DAX for my column: Average Orders Per Hour = DIVIDE(count(Query1[orders]),sum(Query1[hoursworked]))

 

Appreciate any and all help!

 

-Josh

3 REPLIES 3
Anonymous
Not applicable

can you explain how did you get orders 100, 60 from the above table? what formula used for that?

 

Thanks

Raj

I just threw some numbers in there. Here is a table that matches the quantities in the raw data.

EmployeeOrdersHours (WRONG)Avg per Hour (WRONG)Hours (Wanted)Avg per Hour (WANTED)
James1045.80.21834061113.20.757576
Sue10410.243902439210.47619
Anonymous
Not applicable

@jfunderburk,

How do you get hours(13.2, 21) based on the sample data you post in the original post? When you create a measure using the DAX you post, you should get expected result.

Regards,
Lydia

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors