I am trying to figure out how to multiply the unreliability of all the sub-components per year.
I was thinking of creating an array for each year and use "Product" function to multiply all of the element within the array. But I feel like it will be loop within loops. Is there any suggestion to achieve this task?
Thank you.
Try using this formula
If( Row() == 1,
x = :Useful Life Unreliability Rollup per Subcomponent type
);
If( Lag( :year ) != :year,
x = :Useful Life Unreliability Rollup per Subcomponent type,
x = :Useful Life Unreliability Rollup per Subcomponent type * x
);
x;
@mquyen ,
the question you are asking should have been very simple to answer if only the tables>> summary platform or the Analyse >> tabulate procedure would have "Product" as an option.
meanwhile the way i would do it is as follows:
first split the table by year and group by subcomponent. then product is available as an option in formula for a new column.
Names Default To Here( 1 );
dt1 = New Table( "original",
Add Rows( 16 ),
New Column( "Sub-Component",
Character,
"Nominal",
Set Values( {"a1", "a1", "a1", "a2", "a2", "a2", "a3", "a3", "a3", "a4", "a4", "a4", "dc1", "dc1", "dc1", "dc2"} )
),
New Column( "Year", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1] ) ),
New Column( "unreliability", Numeric, "Continuous", Format( "Best", 12 ), Formula( Random Normal() ^ 2 ) )
);
dt2 = dt1 << Split(
Split By( :Year ),
Split( :unreliability ),
Group( :"Sub-Component"n ),
Output Table( "splilt_table.jmp" ),
Sort by Column Property
);
// New formula column: 1*2*3
dt2 << New Formula Column( Operation( Category( "Combine" ), "Product" ), Columns( :"1"n, :"2"n, :"3"n ) );
if you run this once, next time you can do the same on your data either by script or by clicking from menus. both should be reasonably easy.
please let us know if it works for you.