Recent PostsRecent Posts Popular TopicsPopular Topics
 Home Search Members Calendar Who's On

 Calculating Yield Rate Topic Display Mode Topic Options
Author
 Message
 Posted Monday, October 22, 2012 3:43 PM
 SSC-Enthusiastic Group: General Forum Members Last Login: Wednesday, May 20, 2015 4:44 AM Points: 106, Visits: 365
 Hi all,I'm running into an issue calculating yield. `;with totalcount as (select cast(count(sn) as decimal) as totalfrom completedUnit)select (100 - (cast(count(distinct sn) as decimal)/(select * from totalcount))*100) as 'yield'from productiondefect`The following works however, I need to group weekly and by operatorThis does not work`;with totalcount as (select cast(count(sn) as decimal) as totalfrom completedUnit)select (100 - (cast(count(distinct sn) as decimal)/(select * from totalcount))*100) as 'yield'from productiondefectwhere sn = (select c.sn from completedUnit as c join productiondefect as d on c.sn = d.sn where c.operator = 'Operator')`
Post #1375757
 Posted Wednesday, October 24, 2012 12:40 PM
 SSC-Enthusiastic Group: General Forum Members Last Login: Wednesday, May 20, 2015 4:44 AM Points: 106, Visits: 365
 Ok. I got the below to run. The formula returns weekly defects / overall production totals. I want to calculate weekly defect / weekly production. Is this possible?`;with totalcount as (select cast(count(sn) as decimal) as totalfrom completedUnitwhere MONTH(dateentered) = '10' and operator = 'operator')select (100 - (cast(count(distinct d.sn) as decimal)/(select * from totalcount))*100) as 'yield'from productiondefect as djoin completedUnit as c on d.sn = c.snwhere MONTH(c.dateentered) = '10' and c.operator = 'operator'GROUP BY DATEADD(wk, DATEDIFF(wk, 7, c.dateentered), 7)ORDER BY DATEADD(wk, DATEDIFF(wk, 7, c.dateentered), 7)`
Post #1376631
 Posted Wednesday, October 24, 2012 2:44 PM
 SSC-Enthusiastic Group: General Forum Members Last Login: Wednesday, May 20, 2015 4:44 AM Points: 106, Visits: 365
 Below are my results:yield94.400000000000000097.600000000000000098.400000000000000096.8000000000000000Now, I need to get rid of the zeros and show dates.
Post #1376681
 Posted Wednesday, October 24, 2012 4:25 PM
 SSCrazy Eights Group: General Forum Members Last Login: Today @ 10:19 AM Points: 8,214, Visits: 17,772
 kabaari (10/24/2012)Below are my results:yield94.400000000000000097.600000000000000098.400000000000000096.8000000000000000Now, I need to get rid of the zeros and show dates.You should do formatting on the front end.But if you must do it here, an easy way is `CAST( yield AS decimal( 3,1))` Luis C.General Disclaimer:Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?How to post data/code on a forum to get the best help: Option 1 / Option 2
Post #1376715
 Posted Wednesday, October 24, 2012 4:28 PM
 SSCrazy Eights Group: General Forum Members Last Login: Today @ 10:19 AM Points: 8,214, Visits: 17,772