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
ankur_raj
Regular Visitor

Issue with averaging time when day cross over happens

I have created a microsoft flow which feeds email receipt date and time into an excel and I using it as a datasource for analysis. Emails are the batch job completion notification. Some jobs typically finish before midnight but once in a while job crosses midnight and the average come out wrong. i.e. on 09/02/2017 job finished at 23:00 while on 09/04/2017 job finished at 1:00. When averaging the time instead of getting 00:00, I get 12:00 which is not what I am looking for. One solution I have in mind is that I can potentially convert time to a number i.e. 09/02/2017 completion time 23.0 and if job completion time is after midnight I add that duration to 24 to get the correct average i.e. 09/04/2017 1:00 will become 24.0+1.0 = 25.0. Now when I take the average of 23.0 and 25.0 it will come out to be 24.0. But things will get tricky if job consistently finishes after midnight but sometime finishes before midnight, in that case I will get number like 24.5 etc which doesn't make sense to everybody. I can create specific logic for each job based on frequency of job finish before or after midnight, but I am wondering if there is a better solution out there where I can do this averaging without having to convert time into a numerical value on writing scenario specific rules as in the future if the frequency of the job finish timing changes, I will have to analyze and redo the logic.

2 REPLIES 2
v-sihou-msft
Employee
Employee

@ankur_raj

 

Can you share some sample data?

 

In this scenario, I suggest you add a flag column to tag a job is started/finished. Then always use each pair of "started" & "finished" entries to calculate the duration. And when averaging the data, you only need to take the count of dates with "started" on denominator.

 

Regards,

Unfortunately in this case I only receive an email when the job is completed. I don't have the information on the job start date and time.

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.