Note that there are some explanatory texts on larger screens.

plurals
  1. POStatistical Process Control Charts in SQL Server 2008 R2
    primarykey
    data
    text
    <p>I'm hoping you can point me in the right direction.</p> <p>I'm trying to generate a control chart (<a href="http://en.wikipedia.org/wiki/Control_chart" rel="nofollow">http://en.wikipedia.org/wiki/Control_chart</a>) using SQL Server 2008. Creating a basic control chart is easy enough. I'd just calculate the mean and standard deviations and then plot them.</p> <p>The complex bit (for me at least) is that I would like the chart to reset the mean and the control limits when a step change is identified.</p> <p>Currently I'm only interested in a really simple method of identifying a step change, 5 points appearing consecutively above or below the mean. There are more complex ways of identifying them (<a href="http://en.wikipedia.org/wiki/Western_Electric_rules" rel="nofollow">http://en.wikipedia.org/wiki/Western_Electric_rules</a>) but I just want to get this off the ground first.</p> <p>The process I have sort of worked out is:</p> <ol> <li>Aggregate and order by month and year, apply row numbers.</li> <li>Calculate overall mean</li> <li>Identify if each data item is higher, lower or the same as the mean, tag with +1, -1 or 0.</li> <li>Identify when their are 5 consecutive data items which are above or below the mean (currently using a cursor).</li> <li>Recalculate the mean if 5 points are above or 5 points are below the mean.</li> <li>Repeat until end of table.</li> </ol> <p>Is this sort of process possible in SQL server? It feels like I maybe need a recursive UDF but recursion is a bit beyond me!</p> <p>A nudge in the right direction would be much appreciated!</p> <p>Cheers</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload