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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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