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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
npowers2
Frequent Visitor

Calculating Average of a COUNT

I am working on creating a p-chart for my data for metric tracking of defects that we identify. I have been able to calculate the proportion for each variable using the following measure:

 

 

Proportion = 
VAR Defects = AVERAGEX(SUMMARIZE(Query1, Query1[Profile Result], "_Defects", CALCULATE(COUNT(Query1[SampleNumber]))),[_Defects])

VAR Tested = CALCULATE(COUNTA(Query1[SampleNumber]), ALLEXCEPT(Query1, Query1[Week]))

Return
Defects / Tested

 

 

I have been having issues with generating the necessary measures for p-bar and my control limits:

 

pbar = CALCULATE([SUM Defects] / [SUM Tested], ALLSELECTED(Query1))
UCL = [pbar] + 3*SQRT(([pbar]*(1-[pbar])) / Average(Query1[Tested]))

 

The issue that I am running into is not being able to determine how to SUM all results for the entire data set as a SUM TESTED result and SUM all Results based on [Profile Result] as a SUM TESTED result. 

 

Any help would be greatly appreciated. 

4 REPLIES 4
Anonymous
Not applicable

Hi @npowers2 ,

 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it.

 

Best Regards,
Eyelyn Qin

Anonymous
Not applicable

Hi @npowers2 ,

 

Not very clear.

If want to sum values of each Profile Result? You could use the following formula:

SUM based on Profile Result =
CALCULATE (
    SUM ( Query1[Column] ),
    FILTER ( 'Query1', 'Query1'[Profile Result] = MAX ( 'Query1'[Profile Result] ) )
)

Please describe in more detail the result you want.

 

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

amitchandak
Super User
Super User

@npowers2 ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak,

Below is a link to an example data set:

Example Data 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors