← calc operator page · clause/calc/measure_default/new_component_is_measure
pandas ✅ · DuckDB ✅
calc Me_2 := Me_1 * 2 with no role: Me_2 is not in DS_1.
Calculation of a Component: "When the role is omitted, the following rule is applied: ... if the component does not exist in the operand Data Set then its role is Measure", and "If the calculated Component is a new Component, it is added to the output Data Set".
Id_1 and Me_1, plus the Measure Me_2 = 20, 40 and 60, an Integer as Me_1 * 2 is in Manual example 1. Manual example 1 covers the other half of the rule, an existing measure, and Existing attribute keeps role an existing attribute.
DS_r := DS_1 [ calc Me_2 := Me_1 * 2 ];
| Id_1 | Me_1 |
|---|---|
| 1 | 10 |
| 2 | 20 |
| 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 | 20 |
| 2 | 20 | 40 |
| 3 | 30 | 60 |
{
"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"}
]
}
]
}