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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
ninos-shiba
Resolver I
Resolver I

Is this the right way to calculate the Average Time to Resolve a Case?

I've built a Power App time tracker for employees that work on cases. The data is stored in a SharePoint List and looks like this:

 

CaseStart TimeFinish TimeTotal Time Spent (hours)
12347:00 AM9:00 AM2
123410:00 AM12:00 PM2
99991:30 PM4:30 PM3

 

Before, I was just taking the AVERAGE of the Total Time Spent column, but the number was very low. I think I may have to divide by a distinct count of the case number, something like this:

Average Time per Case (min) = (SUM(Records[Time Spent (mins)]) / DISTINCTCOUNT(Records[Case Number])) + 0
 
Is that correct?
1 ACCEPTED SOLUTION
Anonymous
Not applicable

@ninos-shiba 

 

What MY formula does is this:

1. In the current context it looks for different values of Case.

2. Then, for each such Case it calculates the sum of Time Spent (mins). Meaning, it adds up all the values for this very Case.

3. It averages these sums.

 

Your formula is plain wrong as it does not effect context transition. Check out my formula and you'll see they calculate 2 different things. Your formula must wrap SUM(...) in CALCULATE to be similar to mine.

 

The outcome depends on what you have in your table and if the records that belong to the same Case are non-overlapping periods. If they do overlap, then this formula will overstate the time. However, I can see from the sample table of yours that the periods are non-overlapping.

 

By the way, it really matters where you add the "+ 0" bit. If you do it under the AVERAGEX function, then you'll also count in the Cases that have no Time Spent (mins). This will most likely understate the figure. You should, I think, add the 0 to outside the formula: AVERAGEX(...) + 0.

 

If the above does not explain everything, it means you have not shown us everything about your model.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

This is more readable but does the same thing (if you want blank to be 0, add 0 like you have in your formula):

 

// This measure is the counterpart of a measure
// such as, for instance, [Total Manhours] where
// you sum up time of all the workers, so in a day
// you could have more than 24 hours.
[Total Casetime] = sum( Records[Time Spent (mins)] )

[Avg Time per Case] = // a measure, not a calculated column
averagex(
    distinct( Records[Case] ),
    [Total Casetime]
)

 

 

Using that formula, the number jumped up from 107 minutes to 87,000 minutes:

Average Time per Case (min) = AVERAGEX(DISTINCT(Records[Case Number]), SUM(Records[Time Spent (mins)]) + 0)
 
Did I do something wrong?
Anonymous
Not applicable

@ninos-shiba 

 

What MY formula does is this:

1. In the current context it looks for different values of Case.

2. Then, for each such Case it calculates the sum of Time Spent (mins). Meaning, it adds up all the values for this very Case.

3. It averages these sums.

 

Your formula is plain wrong as it does not effect context transition. Check out my formula and you'll see they calculate 2 different things. Your formula must wrap SUM(...) in CALCULATE to be similar to mine.

 

The outcome depends on what you have in your table and if the records that belong to the same Case are non-overlapping periods. If they do overlap, then this formula will overstate the time. However, I can see from the sample table of yours that the periods are non-overlapping.

 

By the way, it really matters where you add the "+ 0" bit. If you do it under the AVERAGEX function, then you'll also count in the Cases that have no Time Spent (mins). This will most likely understate the figure. You should, I think, add the 0 to outside the formula: AVERAGEX(...) + 0.

 

If the above does not explain everything, it means you have not shown us everything about your model.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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