Creating calculated fields
Sometimes, the data in the base tables cannot be used directly, and must use an expression to change or "correct" it. For other use cases, you can create a calculation based on one or more fields. Instead of adding these expression for every visual, in CDP Data Visualization, you can easily create a new calculated field in the dataset, and subsequently use it in dashboards and visuals.
The following steps demonstrate how to create a new field
gdp
(gross
domenstic product) in the dataset World Life Expectancy [data source
main.world_life_expectancy
]. We define it by the following
equation:gdp = gdp_per_capita x population
CDP Data Visualization
supports three primary methods of editing fields at the dataset level:
Basic, Expression, and Display
Format. In this example, we make changes both on the
Basic and Expression tabs. For innformationn
on how to use Display Format options, see Changing the Field
Display Format..Testing calculated fields
In CDP Data Visualization, you can easily test whether a newly calculated field works correctly or not.
The two measurements appear on the graph, superimposed on each other: the original
gdp_per_capita
represented by the bars, and the calculated
gdp
, represented by the line.