← nvl operator page · conditional/nvl/comp_comp/second_component_fills_nulls
pandas ✅ · DuckDB ✅
nvl ( Me_1, Me_2 ) inside calc: two components of the same data set, with a null Me_1 and, in one data point, a null Me_2 as well.
Nvl: "The operator nvl returns the value from op2 when the value from op1 is null, otherwise it returns the value from op1."
Me_3 is 10, 200 and null: Me_1 is kept where it is not null; where it is null the result is Me_2, which is null at id 3.
DS_r := DS_1[calc Me_3 := nvl ( Me_1, Me_2 )];
| Id_1 | Me_1 | Me_2 |
|---|---|---|
| 1 | 10 | 100 |
| 2 | 200 | |
| 3 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true},
{"name": "Me_2", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 | Me_2 | Me_3 |
|---|---|---|---|
| 1 | 10 | 100 | 10 |
| 2 | 200 | 200 | |
| 3 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Me_1", "type": "Integer", "role": "Measure"},
{"name": "Me_2", "type": "Integer", "role": "Measure"},
{"name": "Me_3", "type": "Integer", "role": "Measure"}
]
}
]
}