The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
We are using Power BI to report progress on employee timesheets which are fed data from an outside field ticketing system. We look at various components of this data, but one of the things we are trying to do is identify employees who have move than 24 hours in a day and simply report the total number of distinct employees on a card. The main data set we are using looks like this
EMPLOYEEID | FIRST_NAME | LAST_NAME | DATE | HOURS | DESCRIPTION | STATUS | JOB | ACTIVITY | BUSINESS_LINE | BASE | TICKET | CUSTOMER | COMMENT | WORKED_STATE | STARTTIME | ENDTIME | EMP_DEFAULT_BASE | EMP_PAY_PERIOD_PROFILE | SOURCE |
2 | Jimbo | Jones | 1/29/2022 | 9 | TimeEntry | Approved | GLE-22-PM-0052 | Job Time | Services | West Texas | GLE-22-PM-0052-016-077 | Customer 1 | rig up crew | NM | - | - | West Texas | Bi-Weekly Hourly | FieldTicket |
2 | Jimbo | Jones | 1/29/2022 | 2 | TimeEntry | Approved | GLE-22-PM-0052 | Drive Time | Services | West Texas | GLE-22-PM-0052-016-077 | Customer 1 | rig up crew | NM | - | - | West Texas | Bi-Weekly Hourly | FieldTicket |
2 | Jimbo | Jones | 1/29/2022 | 6 | TimeEntry | Approved | GLE-22-PM-0070 | Job Time | Services | West Texas | GLE-22-PM-0070-018-067 | Customer 2 | FieldTicket Time | TX | - | - | West Texas | Bi-Weekly Hourly | FieldTicket |
2 | Jimbo | Jones | 1/29/2022 | 4 | TimeEntry | Approved | GLE-22-PM-0070 | Drive Time | Services | West Texas | GLE-22-PM-0070-018-067 | Customer 2 | FieldTicket Time | TX | - | - | West Texas | Bi-Weekly Hourly | FieldTicket |
2 | Jimbo | Jones | 1/29/2022 | 5 | TimeEntry | Approved | GLE-22-PM-0073 | Drive Time | Services | West Texas | GLE-22-PM-0073-016-078 | Customer 1 | Drillout | NM | - | - | West Texas | Bi-Weekly Hourly | FieldTicket |
2 | Jimbo | Jones | 1/29/2022 | 7 | TimeEntry | Approved | GLE-22-PM-0073 | Job Time | Services | West Texas | GLE-22-PM-0073-016-078 | Customer 1 | Drillout | NM | - | - | West Texas | Bi-Weekly Hourly | FieldTicket |
2 | Jimbo | Jones | 1/28/2022 | 3 | TimeEntry | Approved | GLE-22-PM-0068 | Drive Time | Services | West Texas | GLE-22-PM-0068-019-096 | Customer 3 | FieldTicket Time | TX | - | - | West Texas | Bi-Weekly Hourly | FieldTicket |
2 | Jimbo | Jones | 1/28/2022 | 5 | TimeEntry | Approved | GLE-22-PM-0068 | Job Time | Services | West Texas | GLE-22-PM-0068-019-096 | Customer 3 | FieldTicket Time | TX | - | - | West Texas | Bi-Weekly Hourly | FieldTicket |
2 | Jimbo | Jones | 1/27/2022 | 10 | TimeEntry | Approved | GLE-22-PM-0068 | Job Time | Services | West Texas | GLE-22-PM-0068-019-095 | Customer 3 | FieldTicket Time | TX | - | - | West Texas | Bi-Weekly Hourly | FieldTicket |
2 | Jimbo | Jones | 1/26/2022 | 5 | TimeEntry | Approved | GLE-22-PM-0052 | Drive Time | Services | West Texas | GLE-22-PM-0052-000-372 | Customer 1 | FieldTicket Time | NM | - | - | West Texas | Bi-Weekly Hourly | FieldTicket |
2 | Jimbo | Jones | 1/26/2022 | 16 | TimeEntry | Approved | GLE-22-PM-0052 | Job Time | Services | West Texas | GLE-22-PM-0052-000-372 | Customer 1 | FieldTicket Time | NM | - | - | West Texas | Bi-Weekly Hourly | FieldTicket |
2 | Jimbo | Jones | 1/18/2022 | 2 | TimeEntry | Approved | GLE-22-PM-0043 | Drive Time | Services | West Texas | GLE-22-PM-0043-000-346 | Customer 4 | FieldTicket Time | TX | - | - | West Texas | Bi-Weekly Hourly | FieldTicket |
2 | Jimbo | Jones | 1/18/2022 | 9 | TimeEntry | Approved | GLE-22-PM-0043 | Job Time | Services | West Texas | GLE-22-PM-0043-000-346 | Customer 4 | FieldTicket Time | TX | - | - | West Texas | Bi-Weekly Hourly | FieldTicket |
2 | Jimbo | Jones | 1/18/2022 | 2 | TimeEntry | Approved | GLE-00-PM-TRAI | Drive Time | Services | West Texas | Travel From Loc | TX | 07:00p | 09:00p | West Texas | Bi-Weekly Hourly | |||
2 | Jimbo | Jones | 1/17/2022 | 5 | TimeEntry | Approved | ICE-99-99-9999 | Shop Time | Services | West Texas | loc to fix pumps | TX | 02:00p | 07:00p | West Texas | Bi-Weekly Hourly | |||
2 | Jimbo | Jones | 1/17/2022 | 2 | TimeEntry | Approved | GLE-00-PM-SHOP | Shop Time | Services | West Texas | Work on Equip | TX | 12:00p | 02:00p | West Texas | Bi-Weekly Hourly | |||
2 | Jimbo | Jones | 1/16/2022 | 2 | TimeEntry | Approved | GLE-22-PM-0036 | Drive Time | Services | West Texas | GLE-22-PM-0036-044-023 | Customer 5 | FieldTicket Time | TX | - | - | West Texas | Bi-Weekly Hourly | FieldTicket |
2 | Jimbo | Jones | 1/16/2022 | 12 | TimeEntry | Approved | GLE-22-PM-0036 | Job Time | Services | West Texas | GLE-22-PM-0036-044-023 | Customer 5 | FieldTicket Time | TX | - | - | West Texas | Bi-Weekly Hourly | FieldTicket |
So based on the above data, we are extracting the data from the 01/29/2022 as the sum of these records are greater than 24 hours. That table displays the employee, with the total hours by day. What we are hoping to do is to have a card on our summary dashboard that counts the number of emloyees in this situation. ie in this case, the card would show a value of 1. The only way i have figured to do this so far is to group the data employee and Date in another dataset and then use a count of the employee measure to display the value. It feels like there should be a way to do this without duplicating the data in another dataset. Any suggestions would be greatly appreciated.
Thanks
Solved! Go to Solution.
Hi @edge9999 ,
Any updates?
Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or if you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.
How to provide sample data in the Power BI Forum
How to Get Your Question Answered Quickly
Best Regards,
Eyelyn Qin
Hi @edge9999 ,
If I understood correctly, you would like to count all distinct [EMPLOYEEID] that have more than 24 [HOURS] per [DATE].
I used your data and added a couple of more dummy rows (first two rows and last row) so that the table looks like this:
With this example data, we have 3 occasions where an employee has more than 24 hours:
- Employee 2 on 1/15/2022 with 27 hours
- Employee 2 on 1/29/2022 with 33 hours
- Employee 3 on 1/18/2022 with 32 hours
So, in total we have two different employees, which should be displayed on that card visual, which you can see here for tomsmeasure3:
This is the DAX for that measure:
tomsmeasure3 = IF( CALCULATE ( SUM ('Table'[HOURS] ), ALLEXCEPT('Table','Table'[DATE],'Table'[EMPLOYEEID]) ) > 24, DISTINCTCOUNT('Table'[EMPLOYEEID]), BLANK() )
The other two measures are just dummy measures I used to get to the solution (1: sum up hours, 2: get max(ID) for hours > 24)
Hope this helps!
/Tom
https://www.instagram.com/tackytechtom
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! | |
#proudtobeasuperuser | |
Thanks a bunch.. i'll give it a try.
User | Count |
---|---|
15 | |
8 | |
6 | |
6 | |
6 |
User | Count |
---|---|
23 | |
14 | |
13 | |
8 | |
8 |