Forum Discussion

leon_taljaard's avatar
leon_taljaard
Frequent Visitor
4 years ago
Solved

Power Bi Desktop staff activities time sheet

Hi There,    Please could someone assist. I am not that familiar with Power Bi. I am trying to work out how many hours someone has worked from SharePoint list data into Power Bi Desktop.  Now I ha...
  • v-xiaotang's avatar
    4 years ago

    Hi leon_taljaard 

    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)/60
    Measure = 
    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: "&_time

    result

     

     

    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.