Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

Monthly AVG worktime

Hello everyone. I am trying to calculate monthly AVG workime of my people in salesforce. I have got information about every visit they did and its duration. People in salesforce do about 10-12 visits per day. To calculate daily work time I used formula below

 

Daily Worktime = MIN(Visits[Visist Start Time])-MAX(Visits[Visit End Time])

 

but it only works when I create a table chart when I add Visit date and later when I want to aggregate it to monthly worktime it doesn't count properly. 

 

The formula I tried to count montly worktime is below
 
Measure = GROUPBY(Visits;Visits[Sales Representant];Visits[Visit Start Date].[Day];"NewTableName";CALCULATE(MINX(CURRENTGROUP();[Visit Start Time]) - MAXX(CURRENTGROUP();[Visit End Time])))
 
Data sample is below.
 
Manager1Manager2Sales RepresentantClientIDVisist Start dateVisist Start timeVisist End dateVisist End timeVisit Duration
AdamJanMarcin145615-06-201908:4515-06-201909:3000:45
AdamJanMarcin145617-06-201909:3517-06-201909:5000:15
 
 
 
Thank you so much for help.

2 Replies

  • v-xuding-msft's avatar
    v-xuding-msft
    Community Support

    Hi Anonymous ,

    Do you consider the difference between  Visit End Time and Visit Start Time? Like the sample data, do you want 65min or 60min between them?

     

    I calculated AVG without considering the difference. 

    Measure = DIVIDE(DATEDIFF(MIN('Table'[Visist Start time]),MAX('Table'[Visist End time]),MINUTE),30)

    Is this what you want? If not, can you please post the dummy file or the expected output?

     

    Best Regards,

    Xue

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello v-xuding-msft ,

      thank you for responding. I consider visit duration for other measures like sum of time spent in shops but to count MONTHLY worktime I do not use it. 

      I tried to use your formula and results it gives doesn't answer my question. I need to count averegea monthly time per person. Results of your formula is below. What does this measure shows? 

       

       

      I am wondering if information about every visit it enought to count MONTHLY worktime per VisitUserName?