Subscribe Bookmark RSS Feed

Running a quick calculation on a subset of data

Please see comments below. The part of the code I need some assistance on is on how to compute a condition on the subset of rows and return to variable result2.

dt << clear row states;
dt << select where( !(:PartNo == "81817" & :Month == "1/2010" & :JobID == "PROD" )) << Exclude( 1 ) << Hide( 1 );
dt << invert row selection;
result = dt << Get selected rows;
result = N Row (result);
// Code works fine up to this point


//Would like to run additional analysis only on selected rows,
// however, the following code carries out the calculation on the entire col
// instead of just the selected rows
result2 = dt << Select Where (:Name("Margin Col")<=5);
result2 = N Row (result2);

FailRate = result2/result;
1 REPLY
> Please see comments below. The part of the code I
> need some assistance on is on how to compute a
> condition on the subset of rows and return to
> variable result2.
>
> dt << clear row states;
> dt << select where( !(:PartNo == "81817" & :Month ==
> "1/2010" & :JobID == "PROD" )) << Exclude( 1 ) <<
> Hide( 1 );
> dt << invert row selection;
> result = dt << Get selected rows;
> result = N Row (result);
> // Code works fine up to this point
>
>
> //Would like to run additional analysis only on
> selected rows,
> // however, the following code carries out the
> calculation on the entire col
> // instead of just the selected rows
> result2 = dt << Select Where (:Name("Margin
> Col")<=5);
> result2 = N Row (result2);
>
> FailRate = result2/result;

dt << clear row states;
dt << select where( !(:PartNo == "81817" & :Month == "1/2010" & :JobID == "PROD" )) << Exclude( 1 ) << Hide( 1 );
dt << invert row selection;
result = dt << Get selected rows;
result = N Row (result);
// Code works fine up to this point


//Would like to run additional analysis only on selected rows,
// however, the following code carries our the calculation on the entire col
// instead of just the selected rows
result2 = dt << Select Where (:Name("Margin Col")<=5);
result2 = N Row (result2);