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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
glynwilks
Helper I
Helper I

Count number of agents whose working day is true

I have a CRM where I need to calculate agent utilisation. My problem is that I have agents who have shifts on different days. I need to calculate the number of agents whose working day is true. From here I can then work out the total capacity hours for the month based on 7.6 hour days.

 

There are 4 tables in play

[Agents - Time Entries] - This is the agent table which liks to Work Shifts via Workday ID

[Work Shifts] - This is the roster table which links to Working Days via Workday ID

[Working Days] - This is working days table that links to the Date Table via Weekday ID

[Date Table] - Is the date table which also has day types for public holidays.


In my report I need to work out capacity hours based on the number of working agents per day for that period. So for example, If there are 30 days it would be total working days for the period multiplied by 7.6. Each day would be multipled by the number of working agents, then added together for the period to give total working days. The number of working agents would vary from day to day, so it would need to be able to calculate agent count per day.
Tables Below

Agent IDAgent NameAgent DisabledWorkday IDDate Created
3Agent OneFALSE59/01/2019 9:37
13Agent TwoFALSE325/07/2022 7:58
14Agent ThreeFALSE827/07/2022 5:58

 

Work Shifts

 

Workday IDWorkday MondayTuesdayWednesdayThursdayFridaySaturdaySunday
108:00-5:00PM ShiftTRUETRUETRUETRUETRUEFALSEFALSE
224 HoursTRUETRUETRUETRUETRUETRUETRUE
37:30 ShiftTRUETRUETRUETRUETRUEFALSEFALSE
48:00 ShiftTRUETRUETRUETRUETRUEFALSEFALSE
58:30 ShiftTRUETRUETRUETRUETRUEFALSEFALSE
6Part Time ShiftFALSEFALSETRUETRUETRUEFALSEFALSE
7South African ShiftTRUETRUETRUETRUETRUEFALSEFALSE
84 Day Week (Tuesday Off)TRUEFALSETRUETRUETRUEFALSEFALSE

 

Working Days

 

Workday IDDay NameWeekday IDIs Working DayWorking Hours
1Monday2TRUE9
1Tuesday3TRUE9
1Wednesday4TRUE9
1Thursday5TRUE9
1Friday6TRUE9
1Saturday7FALSE9
1Sunday1FALSE9
2Monday2TRUE24
2Tuesday3TRUE24
2Wednesday4TRUE24
2Thursday5TRUE24
2Friday6TRUE24
2Saturday7TRUE24
2Sunday1TRUE24
3Monday2TRUE9
3Tuesday3TRUE9
3Wednesday4TRUE9
3Thursday5TRUE9
3Friday6TRUE9
3Saturday7FALSE9
3Sunday1FALSE9
4Monday2TRUE9
4Tuesday3TRUE9
4Wednesday4TRUE9
4Thursday5TRUE9
4Friday6TRUE9
4Saturday7FALSE9
4Sunday1FALSE9
5Monday2TRUE9
5Tuesday3TRUE9
5Wednesday4TRUE9
5Thursday5TRUE9
5Friday6TRUE9
5Saturday7FALSE9
5Sunday1FALSE9
6Monday2FALSE9
6Tuesday3FALSE9
6Wednesday4TRUE9
6Thursday5TRUE9
6Friday6TRUE9
6Saturday7FALSE9
6Sunday1FALSE9
7Monday2TRUE8
7Tuesday3TRUE8
7Wednesday4TRUE8
7Thursday5TRUE8
7Friday6TRUE8
7Saturday7FALSE8
7Sunday1FALSE8
8Monday2TRUE9
8Tuesday3FALSE9
8Wednesday4TRUE9
8Thursday5TRUE9
8Friday6TRUE9
8Saturday7FALSE9
8Sunday1FALSE9

 

Date Table

 

DateDay NameDate TypeCapacityWeekday ID
Saturday, 1 July 2023SaturdayWeekend07
Sunday, 2 July 2023SundayWeekend01
Monday, 3 July 2023MondayWeekday7.62
Tuesday, 4 July 2023TuesdayWeekday7.63
Wednesday, 5 July 2023WednesdayWeekday7.64
Thursday, 6 July 2023ThursdayWeekday7.65
Friday, 7 July 2023FridayWeekday7.66
Saturday, 8 July 2023SaturdayWeekend07
Sunday, 9 July 2023SundayWeekend01
Monday, 10 July 2023MondayWeekday7.62
Tuesday, 11 July 2023TuesdayWeekday7.63
Wednesday, 12 July 2023WednesdayWeekday7.64
Thursday, 13 July 2023ThursdayWeekday7.65
Friday, 14 July 2023FridayWeekday7.66
Saturday, 15 July 2023SaturdayWeekend07
Sunday, 16 July 2023SundayWeekend01
Monday, 17 July 2023MondayWeekday7.62
Tuesday, 18 July 2023TuesdayWeekday7.63
Wednesday, 19 July 2023WednesdayWeekday7.64
Thursday, 20 July 2023ThursdayWeekday7.65
Friday, 21 July 2023FridayWeekday7.66
Saturday, 22 July 2023SaturdayWeekend07
Sunday, 23 July 2023SundayWeekend01
Monday, 24 July 2023MondayWeekday7.62
Tuesday, 25 July 2023TuesdayWeekday7.63
Wednesday, 26 July 2023WednesdayWeekday7.64
Thursday, 27 July 2023ThursdayWeekday7.65
Friday, 28 July 2023FridayWeekday7.66
Saturday, 29 July 2023SaturdayWeekend07
Sunday, 30 July 2023SundayWeekend01
Monday, 31 July 2023MondayWeekday7.62
3 REPLIES 3
ToddChitt
Super User
Super User

A trick I have used before is that instead of making the [Is Working Day] a TRUE/FALSE field, make it an INTEGER with 1 = True and 0 - False. That way you can SUM that column.




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





Thanks for the tip, I will try that now and report back.

I have tried that, however it still does not work. I feel this is quite a complicated process which requires additional measures.

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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