cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
cchueng
Level II

JSL : Top3 volume per week per site

I have a table below stating the defects per week per manufacturing site. How do I write a JMP script to output another table stating just the top 3 defects per week per site? I am using JMP17.

 

DefectsDateSite1Site2
Bondpad2023_WK4166 
Bump_Deformities2023_WK428681085
Contamination2023_WK47512122763
Crack2023_WK45726 
Discoloration2023_WK41762 
Distorted_Break2023_WK4 56
Lifting2023_WK46717 
Missing_Bump2023_WK4565 
Missing_Die2023_WK4639 
Other2023_WK42855 
Scratch2023_WK49811579122
Test_Failure2023_WK4192 
Twin2023_WK4270411841
Bondpad2023_WK5178 
Bump_Deformities2023_WK5716192
Contamination2023_WK53799943074
Crack2023_WK541102452
Discoloration2023_WK53326 
Lifting2023_WK512145 
Missing_Bump2023_WK5352 
Missing_Die2023_WK5984 
Other2023_WK58878 
Scratch2023_WK57179232075
Streaking2023_WK55 
Test_Failure2023_WK5359 
Twin2023_WK5901110987

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: JSL : Top3 volume per week per site

Here is a little script that produces the below output

txnelson_0-1674950009183.png


Names Default To Here( 1 );
dt = Current Data Table();

dtStack = dt << Stack(
	columns( :Site1, :Site2 ),
	Source Label Column( "Site" ),
	Stacked Data Column( "Defect Count" ),
	Output Table( "Stacked" )
);

dtStack << Sort(
	By( :Date, :Site, :Defect Count ),
	Order( Ascending, Ascending, Descending ),
	Replace Table( 1 )
);

// New column: Column 5
dtStack << New Column( "Rank",
	Numeric,
	"Continuous",
	Format( "Best", 12 ),
	formula( Col Cumulative Sum( 1, :Date, :Site ) )
);

dtStack:Rank << delete formula;

dtStack << Select Where( :Rank > 3 );
dtStack << delete rows;
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: JSL : Top3 volume per week per site

Here is a little script that produces the below output

txnelson_0-1674950009183.png


Names Default To Here( 1 );
dt = Current Data Table();

dtStack = dt << Stack(
	columns( :Site1, :Site2 ),
	Source Label Column( "Site" ),
	Stacked Data Column( "Defect Count" ),
	Output Table( "Stacked" )
);

dtStack << Sort(
	By( :Date, :Site, :Defect Count ),
	Order( Ascending, Ascending, Descending ),
	Replace Table( 1 )
);

// New column: Column 5
dtStack << New Column( "Rank",
	Numeric,
	"Continuous",
	Format( "Best", 12 ),
	formula( Col Cumulative Sum( 1, :Date, :Site ) )
);

dtStack:Rank << delete formula;

dtStack << Select Where( :Rank > 3 );
dtStack << delete rows;
Jim
cchueng
Level II

Re: JSL : Top3 volume per week per site

Jim, it works beautifully! Thanks!