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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Dax Query to Calculate Cp Cpk using sigma estimator as sbar/c4 in PowerBI

i am in a very peculiar requirement of calculating cp cpk in powerbi using the formula for sigma estimator as "sbar/c4" check reference link here

My sample data is as given below

DATE Country Name State Type State Name City Lable PO Box No Box Size READINGS Value LSL USL
06-10-2019DummyGaon37Cap191002110READING718.3118.218.8
09-10-2019DummyGaon37Cap191002110READING718.42818.218.8
16-10-2019DummyGaon37Cap191002110READING718.36418.218.8
19-10-2019DummyGaon37Cap191002110READING718.4818.218.8
22-10-2019DummyGaon37Cap191002110READING718.4918.218.8
28-10-2019DummyGaon37Cap191002110READING718.40718.218.8
01-11-2019DummyGaon37Cap191002110READING718.51218.218.8
17-11-2019DummyGaon37Cap191002110READING718.50618.218.8
19-11-2019DummyGaon37Cap191002110READING718.47218.218.8
21-11-2019DummyGaon37Cap191002110READING718.50718.218.8
22-11-2019DummyGaon37Cap191002110READING718.59618.218.8
19-12-2019DummyGaon37Cap191002110READING718.51718.218.8
21-12-2019DummyGaon37Cap191002110READING718.52918.218.8
22-12-2019DummyGaon37Cap191002110READING718.48118.218.8
23-12-2019DummyGaon37Cap191002110READING718.63418.218.8
01-01-2020DummyGaon37Cap191002110READING718.45118.218.8
02-01-2020DummyGaon37Cap191002110READING718.37518.218.8
03-01-2020DummyGaon37Cap191002110READING718.40318.218.8
06-01-2020DummyGaon37Cap191002110READING718.40418.218.8
07-01-2020DummyGaon37Cap191002110READING718.5418.218.8
10-01-2020DummyGaon37Cap191002110READING718.61418.218.8
12-01-2020DummyGaon37Cap191002110READING718.66818.218.8
13-01-2020DummyGaon37Cap191002110READING718.54818.218.8
16-01-2020DummyGaon37Cap191002110READING718.49718.218.8
25-01-2020DummyGaon37Cap191002110READING718.57718.218.8
26-01-2020DummyGaon37Cap191002110READING718.51718.218.8
28-01-2020DummyGaon37Cap191002110READING718.48118.218.8
09-03-2020DummyGaon37Cap200303110READING718.49918.218.8
15-03-2020DummyGaon37Cap200303110READING718.42918.218.8
17-03-2020DummyGaon37Cap200303110READING718.34718.218.8
17-03-2020DummyGaon37Cap200303110READING718.5918.218.8
19-03-2020DummyGaon37Cap200303110READING718.43318.218.8
22-03-2020DummyGaon37Cap200303110READING718.47818.218.8
26-03-2020DummyGaon37Cap200303110READING718.56918.218.8
29-03-2020DummyGaon37Cap200303110READING718.70118.218.8
29-03-2020DummyGaon37Cap200303110READING718.49618.218.8
30-03-2020DummyGaon37Cap200303110READING718.54818.218.8
31-03-2020DummyGaon37Cap200303110READING718.60418.218.8
01-04-2020DummyGaon37Cap200303110READING718.55818.218.8
02-04-2020DummyGaon37Cap200303110READING718.6318.218.8

here we need to calculate cp cpk for the city label column as a subgroup,... this is a sample but in reality, there would be 1000s of city labels, 10 different country names, 40 state names. PO box no, Readings and Box size is to be ignored

C4 value is decided to be 0.9727 as subgroups are considered to be 10

I want to know how do I create a DAX query to calculate the new sigma value

my current query is like this

    Cpk  = 
VAR sigma = STDEV.S(Table[Value])
VAR estimatedMean = AVERAGE(Table[Value])
VAR Cplower = (estimatedMean-MIN(Table[LSL Value]))/(3*sigma)
VAR Cpupper = (MAX(Table[USL Value])-estimatedMean)/(3*sigma)
RETURN MIN(Cplower,Cpupper)

the new query can dynamically change as per slicers selected in Powerbi eg country, state type, state name, etc

Please help me out, the condition is very critical

1 REPLY 1
v-kelly-msft
Community Support
Community Support

Hi  @Anonymous,

 

The column headers you provide cant match the data below,pls check wheher the headers should be as below:

v-kelly-msft_0-1616663833862.png

What is your expected output?If possible,could you pls upload your sample .pbix file?

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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
Top Kudoed Authors