Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi, I have data that looks like this (basically door access log):
AccessLog
Date| Time | Event | User
1 Jan | 0400 | Access Logged | Jane
1 Jan | 0600 | Access Logged | Jane
1 Jan | 0700 | Access Logged | Jane
1 Jan | 0200 | Access Logged | Bob
1 Jan | 0800 | Access Logged | Bob
1 Jan | 1200 | Access Logged | Bob
2 Jan | 0400 | Access Logged | Jane
2 Jan | 0600 | Access Logged | Jane
2 Jan | 0700 | Access Logged | Jane
2 Jan | 0200 | Access Logged | Bob
2 Jan | 0800 | Access Logged | Bob
2 Jan | 1200 | Access Logged | Bob
I am able to get the hours spend in office each day using:
Hours Worked = (DATEDIFF(FIRSTNONBLANK(AccessLog[Time],1),LASTNONBLANK(AccessLog[Time],1),MINUTE))/60
within a Matrix report with Row = Date, Column = User, Value = Hours Worked
Now, I need to calculate the hours work per user, per month.
How can I sum the above 'Hours Worked' measure, by month for each user?
Solved! Go to Solution.
Hi powerbi9191,
To achieve your requirement, you can create a measure using dax formula below:
Diff = CALCULATE((MAX(AccessLog[Time]) - MIN(AccessLog[Time])) / 60, ALLEXCEPT(AccessLog, AccessLog[Date], AccessLog[User]))
Regards,
Jimmy Tao
Hi powerbi9191,
To achieve your requirement, you can create a measure using dax formula below:
Diff = CALCULATE((MAX(AccessLog[Time]) - MIN(AccessLog[Time])) / 60, ALLEXCEPT(AccessLog, AccessLog[Date], AccessLog[User]))
Regards,
Jimmy Tao
Create a Month column using something like:
Month = RIGHT([Date],3)
If it is an actual Date/Time column:
Month = FORMAT([Date],"mmm")
You will also need a MonthSort column most likely. If it is a date/time column:
MonthSort = MONTH([Date])
If it is a text column, then you will need a Switch statement most likely.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
99 | |
80 | |
64 | |
57 |
User | Count |
---|---|
145 | |
110 | |
91 | |
84 | |
66 |