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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Silvia_Gulu_BXL
Frequent Visitor

How to calculate the average by dividing instead of sum up first?

Hello I have a table like this:

Silvia_Gulu_BXL_0-1707424891156.png

And I calculated how much a project is delayed based on how many tasks are delayed.

So, the on-time rate of the projects is:

Silvia_Gulu_BXL_1-1707424969328.png

 

And now I want to calculate to get the average on-time rate of "Pro 1" and "Pro 2", which is (0+0.67)/2=0.335.

 

I wrote a dax which is:

Silvia_Gulu_BXL_2-1707425097067.png

And I got the result of 0.4 - this isn't what I want.

 

I want to divide to get the on-time rate of each project and then average it.

 

Could you help with that, please?

 

Thank you in advance!

 

Kind regards,

Silvia

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @Silvia_Gulu_BXL 

I'm happy to answer your questions. The reason for calculating 0.4 is as follows: since the total row does not have the filtering function, unlike the previous two rows which have external filters Pro1 and Pro2. In the DAX you wrote, 2/5=0.5, in your table there is Two lines of task delay = No, the total number of lines is 5 lines. In summary, the total line shows 0.4. We can use the following dax to find the average on-time rate of "Pro 1" and "Pro 2":

we can generate a summary table through summarize DAX formula :

Summary table formula:

Table = SUMMARIZE('Sheet1','Sheet1'[Project ID],"Project on-time rate",ROUND(DIVIDE(CALCULATE(DISTINCTCOUNT(Sheet1[Task ID]),'Sheet1'[Task delayed?]="No",ALLEXCEPT('Sheet1','Sheet1'[Project ID])),CALCULATE(DISTINCTCOUNT('Sheet1'[Task ID]),ALLEXCEPT(Sheet1,'Sheet1'[Project ID])))+0,2))

The summary results are as follows:

8.png

Find the average formula:

Project on-time rate1 = 
SUMX('Table','Table'[Project on-time rate])/DISTINCTCOUNT('Table'[Project ID])

The effect is as follows:

9.png

I have provided the PBIX file below, if this helps you, that would be great.

 

 

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi, @Silvia_Gulu_BXL 

I'm happy to answer your questions. The reason for calculating 0.4 is as follows: since the total row does not have the filtering function, unlike the previous two rows which have external filters Pro1 and Pro2. In the DAX you wrote, 2/5=0.5, in your table there is Two lines of task delay = No, the total number of lines is 5 lines. In summary, the total line shows 0.4. We can use the following dax to find the average on-time rate of "Pro 1" and "Pro 2":

we can generate a summary table through summarize DAX formula :

Summary table formula:

Table = SUMMARIZE('Sheet1','Sheet1'[Project ID],"Project on-time rate",ROUND(DIVIDE(CALCULATE(DISTINCTCOUNT(Sheet1[Task ID]),'Sheet1'[Task delayed?]="No",ALLEXCEPT('Sheet1','Sheet1'[Project ID])),CALCULATE(DISTINCTCOUNT('Sheet1'[Task ID]),ALLEXCEPT(Sheet1,'Sheet1'[Project ID])))+0,2))

The summary results are as follows:

8.png

Find the average formula:

Project on-time rate1 = 
SUMX('Table','Table'[Project on-time rate])/DISTINCTCOUNT('Table'[Project ID])

The effect is as follows:

9.png

I have provided the PBIX file below, if this helps you, that would be great.

 

 

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

AmiraBedh
Super User
Super User

The average of Project ID =2/3 = 0.6666666666666667

When Power BI calculates the measure for the on-time rate and the average on-time rate, it uses the full precision of the number in the calculation. So internally, the calculation for a project with 2 out of 3 tasks on time would indeed be 0.6666666666666667.

fter the calculation, when Power BI displays the number in a visual, it applies the formatting settings. By default, it might round the number to two decimal places, hence displaying 0.67 instead of the full precision.

 


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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