Aquí hay 3 de las formas de hacer esto ....... se podrían pensar otros ejemplos
Names Default To Here( 1 );
dt = New Table( "Sample",
Add Rows( 24 ),
New Column( "ID1",
Character,
"Nominal",
Set Values(
{"M101", "M101", "M101", "M101", "M101", "M101", "M101", "M101", "M105", "M105", "M105", "M105", "M105",
"M105", "M105", "M105", "M110", "M110", "M110", "M110", "M110", "M110", "M110", "M110"}
)
),
New Column( "MAIN_RAD",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1] )
),
New Column( "SUB_RAD",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3] )
),
New Column( "COUNT1",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[1796, 1583, 1521, 1621, 1601, 1539, 1639, 1610, 1601, 1539, 1639, 1610, 1856, 1960, 1931, 2004, 1993, 1779,
1820, 1813, 1813, 1736, 1620, 1643]
)
)
);
// Create the column using a formula
dt << New Column( "By Formula",
Character( 16 ),
"Nominal",
Formula(
If( Row() == 1, flag = 0 );
If( Lag( :ID1 ) != :ID1 | Lag( :MAIN_RAD ) != :MAIN_RAD,
flag = 0
);
If( flag == 0 & Col Max( :COUNT1, :ID1, :MAIN_RAD ) == :COUNT1,
Flag = 1;
"Max";
,
""
);
)
);
// Create the column using JSL
dt << New Column( "Using JSL", character );
For( i = 1, i <= N Rows( dt ), i++,
rowID1 = dt:ID1[i];
rowMain_Rad = dt:MAIN_RAD[i];
sameRows = dt << get rows where( dt:ID1 == rowID1 & dt:MAIN_RAD == rowMain_Rad );
If( Max( dt:Count1[sameRows] ) == :COUNT1[i],
dt:Using JSL[i] = "Max"
);
);
// Create the column using Platforms
dtMax = dt << Summary(
invisible,
Group( :ID1, :MAIN_RAD ),
Max( :COUNT1 ),
Freq( "None" ),
Weight( "None" ),
statistics column name format( "column" ),
Link to original data table( 0 )
);
dtMax << delete columns( "N Rows" );
dtMax << New Column( "Using Platform", character, set each value( "Max" ) );
dt << Update( With( dtMax ), Match Columns( :ID1 = :ID1, :MAIN_RAD = :MAIN_RAD, :COUNT1 = :COUNT1 ) );Creo que esto podría ser lo que quieres.Usé una fórmula para hacer el cálculo, pero si lo que hice es correcto, hay varias otras formas de hacerlo.
If( Lag( :ID1 ) == :ID1 & Lag( :MAIN_RAD ) == :MAIN_RAD,
.,
Col Max( :COUNT1, :ID1, :MAIN_RAD )
)

Hola Jim,
Gracias.
Sí, lo probé antes. Lo siento, tal vez no lo describí en detalle anteriormente. En este caso, de cada ID1 y Main_Rad, me gustaría encontrar el valor máximo en la columna COUNT y copiar (ID1, Main_Rad, Count1) en otra tabla. Será similar a lo siguiente:
| ID1 | PRINCIPAL_RAD | SUB_RAD | CONTAR1 | |
| M101 | 0 | 0 | 1796 | máx. |
| M101 | 0 | 1 | 1583 | |
| M101 | 0 | 2 | 1521 | |
| M101 | 0 | 3 | 1621 | |
| M101 | 1 | 0 | 1601 | |
| M101 | 1 | 1 | 1539 | |
| M101 | 1 | 2 | 1639 | máx. |
| M101 | 1 | 3 | 1610 | |
| M105 | 0 | 0 | 1601 | |
| M105 | 0 | 1 | 1539 | |
| M105 | 0 | 2 | 1639 | máx. |
| M105 | 0 | 3 | 1610 | |
| M105 | 1 | 0 | 1856 | |
| M105 | 1 | 1 | 1960 | |
| M105 | 1 | 2 | 1931 | |
| M105 | 1 | 3 | 2004 | máx. |
| M110 | 0 | 0 | 1993 | máx. |
| M110 | 0 | 1 | 1779 | |
| M110 | 0 | 2 | 1820 | |
| M110 | 0 | 3 | 1813 | |
| M110 | 1 | 0 | 1813 | máx. |
| M110 | 1 | 1 | 1736 | |
| M110 | 1 | 2 | 1620 | |
| M110 | 1 | 3 | 1643 | |