← nvl operator page · conditional/nvl/comp_sc/null_replaced_by_zero
pandas ✅ · DuckDB ✅
nvl ( Me_1, 0 ) inside calc: a component and a scalar. The new measure Me_2 is added and Me_1 is left as it is.
Nvl: "The operator nvl returns the value from op2 when the value from op1 is null, otherwise it returns the value from op1."
Me_2 is 10, 0 and 30: the null Me_1 of id 2 becomes 0 in Me_2 and stays null in Me_1.
DS_r := DS_1[calc Me_2 := nvl ( Me_1, 0 )];
| Id_1 | Me_1 |
|---|---|
| 1 | 10 |
| 2 | |
| 3 | 30 |
{
"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 | Me_2 |
|---|---|---|
| 1 | 10 | 10 |
| 2 | 0 | |
| 3 | 30 | 30 |
{
"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"}
]
}
]
}