← calc operator page · clause/calc/measure_explicit/attribute_changed_to_measure
pandas ✅ · DuckDB ✅
calc measure At_1 := At_1: the Attribute At_1 recalculated with its own values and the role measure.
Calculation of a Component: "It is possible to specify the role of the calculated Component among measure, identifier, attribute, or viral attribute, therefore the calc clause can be used also to change the role of a Component when possible."
At_1 keeps its name and its values, 5 and 6, as a Measure: the result has two Measures, Me_1 and At_1.
DS_r := DS_1 [ calc measure At_1 := At_1 ];
| Id_1 | Me_1 | At_1 |
|---|---|---|
| 1 | 10 | 5 |
| 2 | 20 | 6 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true},
{"name": "At_1", "type": "Integer", "role": "Attribute", "nullable": true}
]
}
]
}
| Id_1 | Me_1 | At_1 |
|---|---|---|
| 1 | 10 | 5 |
| 2 | 20 | 6 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Me_1", "type": "Integer", "role": "Measure"},
{"name": "At_1", "type": "Integer", "role": "Measure"}
]
}
]
}