Forum Discussion

mik618's avatar
mik618
Icon for Helper I rankHelper I
6 years ago
Solved

Measure to calculate time worked

Hi There, 

 

I'm looking to try and calculate a measure to show how mant hours & Minutes a staff member worked per day. 

 

Staff work on appointments that have a start date and time, and an end date and time, so I can calculate the total time per appointment.

 

the problem I'm having it that the appointments overlap, as staff can see up to 10 people at a time, so in one day the staffs table might look like this;

 

  startendtotal hours
staffMemberAappointment11pm2pm1
staffMemberAappointment23pm5pm2
staffMemberAappointment34pm6pm2
staffMemberAappointment47pm8pm1
     
   total hours worked5

 

I can't figure out how to only add up hours and minutes the staff had appointments in total

 

any help would be greatly appreciated 

 

Thanks 

9 Replies

  • camargos88's avatar
    camargos88
    Icon for Community Champion rankCommunity Champion

    Hi mik618 ,

     

    I've created this file: Download PBIX 

     

    It creates the ranges for your appointments, so you can calculate without overlaps.

     

    If you consider it as a solution, please mark as a solution and kudos.

    Ricardo

    • mik618's avatar
      mik618
      Icon for Helper I rankHelper I

      Thanks camargos88 for this, 

       

      The only problem (my fault for simplifying the example I gave!) is that appointments can be a matter of minutes, rather than hours, so really i need to count minutes worked, and later convert to total hours and minutes,

       

      Thanks for your help

  • jstorm's avatar
    jstorm
    Icon for Resolver III rankResolver III

    You could use a CALCULATE function with MIN() and MAX() to determine start and end times for the employee's day then simply find the difference.

    EX.

    CALCULATE(
        MAX( [End] ) -

        MIN( [Start] ),

        [Filter1]

    )

    • mik618's avatar
      mik618
      Icon for Helper I rankHelper I

      HI jstorm 

       

      Thanks, but the problem with that is that there are gaps in the day where the staff won't be wokring and I don't want to include this time