Mark Breen
marklbreen at gmail.com
Thu Sep 30 07:02:20 CDT 2010
Hello All,
I have to calculate a Six Sigma value and I have written a function for SQL
Server to calculate it.
>From what I have read, Six Sigma should really be looked up against a set of
values but I also think that it can be approximated using the formula at the
following link http://www.symphonytech.com/articles/sixsigma.htm.
The calculation is credited to Schmidt and Launsby 1997
Can I ask your assistance for the following
1) Are the calculations correct?
2) Would you rename the variables to more appropriate values that are still
readable by non-math experts
Here is the short version and then below I have also pasted my complete
function. X, Y, and Z are the three static values in the Schmidt and
Launsby formula.
SET @X = 0.8406
SET @Y = 29.37
SET @Z = 2.221
SET @DPM= 1000000 / @OrderQty * @DefectQty
SET @NaturalLogOfDPM= log(@DPM)
SET @NaturalLogOfDPMTimesZ = @NaturalLogOfDPM * @Z
SET @CalculatedValueForSQR = @Y - @NaturalLogOfDPMTimesZ
SET @SQROfCalculatedValue = SQRT(@CalculatedValueForSQR)
SET @Result = @X + @SQROfCalculatedValue
Thanks
Mark
Here is the entire SQL Server udf
Create FUNCTION ufn_MB_CalcSixSigma
(
@OrderQty NUMERIC(12,4),
@DefectQty NUMERIC(12,4)
)
RETURNS NUMERIC(12,4)
AS
BEGIN
/*
The calculation is credited to Schmidt and Launsby 1997
*/
DECLARE @DPM NUMERIC(12,4)
DECLARE @X NUMERIC(12,4)
DECLARE @Y NUMERIC(12,4)
DECLARE @Z NUMERIC(12,4)
DECLARE @NaturalLogOfDPM NUMERIC(12,4)
DECLARE @NaturalLogOfDPMTimesZ NUMERIC(12,4)
DECLARE @CalculatedValueForSQR NUMERIC(12,4)
DECLARE @SQROfCalculatedValue NUMERIC(12,4)
DECLARE @Result NUMERIC(12,4)
SET @X = 0.8406
SET @Y = 29.37
SET @Z = 2.221
IF @DefectQty <=0 OR @OrderQty < @DefectQty
SET @Result = -99
ELSE
BEGIN
SET @DPM= 1000000 / @OrderQty * @DefectQty
SET @NaturalLogOfDPM= log(@DPM)
SET @NaturalLogOfDPMTimesZ = @NaturalLogOfDPM * @Z
SET @CalculatedValueForSQR = @Y - @NaturalLogOfDPMTimesZ
SET @SQROfCalculatedValue = SQRT(@CalculatedValueForSQR)
SET @Result = @X + @SQROfCalculatedValue
End
-- Return the result of the function
RETURN @Result
END
GO