By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,573 Members | 3,008 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,573 IT Pros & Developers. It's quick & easy.

How to Calculate Cumulative Percent Failures?

ChaseCox
100+
P: 294
Hi all,

I have a problem that I have been looking at for a couple days now and I can not quite get it to work.

I would like to calculate the cumulative percent failure of a certain product in my table.

:: Cumulative Percent Failure Example:
If you had 100 product shipped, and every month 10 units failed, you would have 10% failure the first month, 20% the second, and so on.

The fields in my table that I am concerned with are [Ship Year], which tells me what year the model shipped, [Model Number] which tells me which product line I am looking at, [QUANTITY] which tells me how many of the units from the product line there are (units produced), [M2F] which tells what month I am on (months to fail), and [SumOfDETAIL_QTY] which tells me how many units failed for that month.

Key factors:



  1. There is more than one product line in the table (1-30 possible)
  2. I need to only consider cumulative failures among alike product lines
I will include what I have done so far:

Here is the SQL code I am using to obtain how many of the products failed in a given month, depending on what year it shipped.

Expand|Select|Wrap|Line Numbers
  1.  SELECT Pre_Analysis.[Ship Year], Pre_Analysis.[Model Number], Pre_Analysis.M2F, Sum(Pre_Analysis.DETAIL_QTY) AS SumOfDETAIL_QTY, Shipping.Quantity
  2. FROM Shipping INNER JOIN Pre_Analysis ON (Shipping.[Ship Year] = Pre_Analysis.[Ship Year]) AND (Shipping.[Model Number] = Pre_Analysis.[Model Number])
  3. GROUP BY Pre_Analysis.[Ship Year], Pre_Analysis.[Model Number], Pre_Analysis.M2F, Shipping.Quantity;
  4.  
Here is a picture of what the query produces as of now
http://img.photobucket.com/albums/v7...g?t=1181073506


Any help on this matter would be greatly appreciated.
Jun 5 '07 #1
Share this Question
Share on Google+
3 Replies


Rabbit
Expert Mod 10K+
P: 12,366
Is this going into a report? Just use a running sum on the report.
Jun 5 '07 #2

ChaseCox
100+
P: 294
Is this going into a report? Just use a running sum on the report.
It would need to be in a table if possible, if not I will not worry about it.
Jun 6 '07 #3

Rabbit
Expert Mod 10K+
P: 12,366
What about multiple subqueries? One to get the total sum and one to get the sum up to that date.
Jun 6 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.