Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

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 2
v-xuding-msft
Community Support
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)

1.PNG

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.

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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? 

 

results.PNG

 

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.