Forum Discussion
Power Bi Desktop staff activities time sheet
- 4 years ago
Thanks for reaching out to us.
Does your data source have an activity id field? If not, you need to increase it, otherwise it is impossible to distinguish different activities with overlapping time
Sample data
create 2 measures, DAX code:
time = DATEDIFF( MIN('Table'[Activity Start Time]),MIN('Table'[Activity End Time]),MINUTE)/60Measure = var _activityID=SELECTEDVALUE('Table'[activity ID]) var _time=MAXX(FILTER(ALL('Table'),'Table'[activity ID]=_activityID),[time]) var _staffname= SELECTEDVALUE('Table'[Staff Name]) return "Staff Name: "&_staffname&UNICHAR(10)&"activity ID: "&_activityID&UNICHAR(10)&"time: "&_timeresult
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
Hi v-xiaotang ,
Thank you so much for the info and your response, it helped a lot but the issue here is that I do have a "Activity ID field" but its not the same for a single activity. So, for example we have Staff 1 who does 5 activities between 08:00 - 09:00 so the ID for the activities would be different, say for example ID 1, ID 2, ID 3, ID 4, ID 5 but in total those 5 activities took 1 hour only or were done in 1 hour but the calulation is still taking it as 5 hours.
See below after creating your measures:
Hope that makes sense I also understood your response correctly 🙂
Thank you again for the support