Hier sind drei Möglichkeiten, dies zu tun. Andere Beispiele könnten erfunden werden
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 ) );
Danke Jim. Das funktioniert auch! Es wäre großartig, wenn ich so etwas wie die folgende Tabelle erhalten könnte, was bedeutet, dass der Maximalwert in der Spalte „Maximun“ in derselben Zeile liegt wie der Maximalwert der Spalte „Count1“.
| ID1 | MAIN_RAD | SUB_RAD | COUNT1 | Maximal |
| M101 | 0 | 0 | 1796 | 1796 |
| M101 | 0 | 1 | 1583 | |
| M101 | 0 | 2 | 1521 | |
| M101 | 0 | 3 | 1621 | |
| M101 | 1 | 0 | 1601 | |
| M101 | 1 | 1 | 1539 | |
| M101 | 1 | 2 | 1639 | 1639 |
| M101 | 1 | 3 | 1610 | |
| M105 | 0 | 0 | 1601 | |
| M105 | 0 | 1 | 1539 | |
| M105 | 0 | 2 | 1639 | 1639 |
| M105 | 0 | 3 | 1610 | |
| M105 | 1 | 0 | 1856 | |
| M105 | 1 | 1 | 1960 | |
| M105 | 1 | 2 | 1931 | |
| M105 | 1 | 3 | 2004 | 2004 |
| M110 | 0 | 0 | 1993 | 1993 |
| M110 | 0 | 1 | 1779 | |
| M110 | 0 | 2 | 1820 | |
| M110 | 0 | 3 | 1813 | |
| M110 | 1 | 0 | 1813 | 1813 |
| M110 | 1 | 1 | 1736 | |
| M110 | 1 | 2 | 1620 | |
| M110 | 1 | 3 | 1643 | |
Übrigens würde es mich interessieren, welche Möglichkeiten es dafür gibt 
Danke. Ich weiß es zu schätzen.
Ich denke, das könnte das sein, was Sie wollen.Ich habe für die Berechnung eine Formel verwendet, aber wenn das, was ich gemacht habe, korrekt ist, gibt es mehrere andere Möglichkeiten, es durchzuführen.
If( Lag( :ID1 ) == :ID1 & Lag( :MAIN_RAD ) == :MAIN_RAD,
.,
Col Max( :COUNT1, :ID1, :MAIN_RAD )
)
