← max operator page · aggregate/max/ds_group_by/string_measure
pandas ✅ · DuckDB ✅
max over a String measure, grouped by Id_1.
Maximum value: "For other comparable scalar types (for example time, string, boolean), the result has the same type as the operand".
the greatest Strings, pear for A and plum for B; in A it is neither the first nor the last value in the order of Id_2. Strings compare character by character (the Greater than page gives false for "hello" > "hi"), and these words start with different letters: apple < fig < kiwi < pear and date < plum.
DS_r := max ( DS_1 group by Id_1 );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| A | 2020Q1 | kiwi |
| A | 2020Q2 | apple |
| A | 2021Q1 | pear |
| A | 2021Q2 | fig |
| B | 2020Q1 | plum |
| B | 2020Q2 | date |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Id_2", "type": "Time_Period", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "String", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 |
|---|---|
| A | pear |
| B | plum |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "String", "role": "Identifier"},
{"name": "Me_1", "type": "String", "role": "Measure"}
]
}
]
}