← case operator page · conditional/case/ds_multi_when/overlapping_named_conditions
pandas ✅ · DuckDB ✅
the two overlapping conditions of "Overlapping inline conditions", named: DS_c1 := DS_1 > 20 and DS_c2 := DS_1 > 10. The example shows only the order in which they are tried, and does not depend on how an engine handles an inline condition.
Case: at data set level the operator "returns the Data Point from the thenOperand when the first Data Point of condition having the same Identifiers’ values evaluates to true; returns the Data Point from elseOperand if none of the when conditions evaluates to true".
(1, 5), (2, 2) and (3, 300): id 3 meets both conditions, and the first wins, so DS_2's 300, not DS_3's 3. No recorded team decision applies, so the expected output follows the manual's "first".
DS_c1 := DS_1 > 20; DS_c2 := DS_1 > 10; DS_r := case when DS_c1 then DS_2 when DS_c2 then DS_3 else DS_1;
| Id_1 | Me_1 |
|---|---|
| 1 | 5 |
| 2 | 15 |
| 3 | 25 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 |
|---|---|
| 1 | 100 |
| 2 | 200 |
| 3 | 300 |
{
"datasets": [
{
"name": "DS_2",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 |
|---|---|
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
{
"datasets": [
{
"name": "DS_3",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 |
|---|---|
| 1 | 5 |
| 2 | 2 |
| 3 | 300 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Me_1", "type": "Integer", "role": "Measure"}
]
}
]
}