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
micklowe
Helper I
Helper I

Calculating Working Hours by Month

Hi All

I want to work out an employees working hours by month for a KPI dashboard based on the following setup.

 

Employee table has 7 fields for the working hours per day:

Employee Name SunMonTuesWedThuFriSat
John 0777770
Peter 0555500
         

 

I have a calendar table using NETWORKDAYS but can't see how to tie the 2 together.

micklowe_0-1710003526209.png

 

Does anyone have any ideas please?

 

I'm trying to build a visual that shows hours logged vs actual hours:

micklowe_1-1710004204100.png

 

Thanks

Mick

 

1 ACCEPTED SOLUTION
StrategicSavvy
Resolver II
Resolver II

hi micklowe

 

Here are the steps to achieve this

1. Group your Employee table by days in PowerQuery (make sure each name of day is 3 letter abbreviation)

StrategicSavvy_0-1710012601402.png

 

2. Add in your calendar table following columns:

I.Number of hours

Number of hours = 
VAR __NumberOfHoursLoggedInADay = 8 // number of hours you would like to log
VAR __NumberOfWorkingPeople = 2 // number of employees
RETURN
'Calendar'[Working Day] * __NumberOfHoursLoggedInADay * __NumberOfWorkingPeople

 

II. Day

Day = FORMAT([Date],"ddd")

 

3. Create relationship (one-to-many) between your calendar and working days aggregated data

StrategicSavvy_1-1710012801981.png

 

 

4. Add new column in your calendar table

Logged Hours = RELATED('Working Hours'[Value])

 

 

5. Create 3 explicit measures

I. 

Total # of Hours = SUM('Calendar'[Number of hours])

 

II. 

Total # of Logged Hours = SUM('Calendar'[Logged Hours])

III,

KPI = DIVIDE([Total # of Logged Hours],[Total # of Hours])

 

6. Add Gauge chart to your report

I. Add Total # of Logged Hours to Values

II. Add Total # of Hours to Maximum

II. Add KPI to tooltips

 

Screen:

StrategicSavvy_3-1710013568132.png

PBIX 

 

 

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: www.linkedin.com/in/lukasz-kozdron 

View solution in original post

2 REPLIES 2
StrategicSavvy
Resolver II
Resolver II

hi micklowe

 

Here are the steps to achieve this

1. Group your Employee table by days in PowerQuery (make sure each name of day is 3 letter abbreviation)

StrategicSavvy_0-1710012601402.png

 

2. Add in your calendar table following columns:

I.Number of hours

Number of hours = 
VAR __NumberOfHoursLoggedInADay = 8 // number of hours you would like to log
VAR __NumberOfWorkingPeople = 2 // number of employees
RETURN
'Calendar'[Working Day] * __NumberOfHoursLoggedInADay * __NumberOfWorkingPeople

 

II. Day

Day = FORMAT([Date],"ddd")

 

3. Create relationship (one-to-many) between your calendar and working days aggregated data

StrategicSavvy_1-1710012801981.png

 

 

4. Add new column in your calendar table

Logged Hours = RELATED('Working Hours'[Value])

 

 

5. Create 3 explicit measures

I. 

Total # of Hours = SUM('Calendar'[Number of hours])

 

II. 

Total # of Logged Hours = SUM('Calendar'[Logged Hours])

III,

KPI = DIVIDE([Total # of Logged Hours],[Total # of Hours])

 

6. Add Gauge chart to your report

I. Add Total # of Logged Hours to Values

II. Add Total # of Hours to Maximum

II. Add KPI to tooltips

 

Screen:

StrategicSavvy_3-1710013568132.png

PBIX 

 

 

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: www.linkedin.com/in/lukasz-kozdron 

Greg_Deckler
Community Champion
Community Champion

@micklowe Well they don't tie together because you don't have a Date in your first table nor do you have a WEEKDAY in your second table. So there's no relationship between them other than what you might invent in a measure. Also, you will likely want to unpivot your weekday columns in your first table otherwise this will be an absolute nightmare.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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.