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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
dhanekula1996
Helper I
Helper I

Dynamic mean for control charts based on rules

Hello,
I am trying to create a control chart based on a set of rules. My mean and standard deviation should change based on set of mentioned rules. Standard rules to calculate the control chart are as follows
1. to calculate mean/ average the minimum data points are 5.

2. To calculate standard deviation the minimum data points are 15.
The required rules for the visualization
1. If seven consecutive points appear above or below the MEAN, the MEAN for the past seven points is recalculated. This is where we would look at the seven points ahead from the first point where it changed.
2. If seven consecutive points are moving either up or down the MEAN is recalculated on the past seven points. This again is where we would look at the seven points ahead from the first point where it changed.

3. If fifteen consecutive points are within +/- 1.0 standard deviation of the MEAN, the standard deviation, UCL and LCL are recalculated. Beginning to the system change point (back to the start of the 15 data points that triggered the recalc). Newly calculated means and standard deviations are used for rule evaluation on the next data points

Sample data is as follows:
 Fiscal_Week    Returns
5/7/2022         4630
5/14/2022       4800
5/21/2022       5069
5/28/2022       2789
6/4/2022         4596
6/11/2022      5275
6/18/2022      5172
6/25/2022      5219
7/2/2022        5101
7/9/2022        5020
7/16/2022       5327
7/23/2022       5001
7/30/2022       5221
8/6/2022         5309
8/13/2022       5225
8/20/2022       5475
8/27/2022       5291
9/3/2022         5371
9/10/2022       4961
9/17/2022       5091
9/24/2022       5355
10/1/2022       4049
10/8/2022      4729
10/15/2022      4869
10/22/2022      4417
10/29/2022      4030
11/5/2022      3698

Sample graph :
Note: Not based on above mentioned data

dhanekula1996_0-1669141045053.png

@amitchandak @Greg_Deckler @Mikelytics @mangaus1111 

2 REPLIES 2
djurecicK2
Super User
Super User

Hi @dhanekula1996,

 You should probably create measures to do all of these calculations, then add the measures to a visual.

 

Power BI does have a standard deviation function:

https://learn.microsoft.com/en-us/dax/stdev-p-function-dax

 

I have tried this for Average calculation but this measure gives me a constant Average value. I need to dynamically vary the average based on the rules mentioned.

Avg Returns_c = CALCULATE(AVERAGEX('01_Date',[ITEM return rate]),ALLSELECTED('01_Date'[Calendar_Date]))

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors