To use the derived data measurements in a calculation, treat it as any other
measurement. In this example, the derived data LifeExpXPop is used
to accurately calculate the weighted life expectancy for an aggregation
dimension, such as UN Region or UN Subregion. You can do this by dividing the sum of
Life Expectancy X Population by sum(population) at the appropriate
aggregate level.
Place the following fields on the Dimensions shelf:
un_region and un_subregion.
Add the derived data field Pop.
Place the field year on the Filters
shelf , and change the expression to
[year]=<<year_param:2000>>.
Place the derived data field LifeExpXPop onto the
Meausres shelf. Notice that it appears as an
aggregation, sum(LifeExpXPop).
Using the Enter/Edit Expression window modal, change the
definition of the field as follows,and click Save.
You can see that the field has been
aliased.
(sum([LifeExpXPop])/sum([population])) as 'Weighted Life Expectancy'
Optional: Use the Alias option to change the column names to UN
Region, UN Subregion
Click Refresh Visual.
The visual should look similar to this one:
[Optional] To see the correctly calculated Life Expectancy for a UN
Region, remove UN Subregion from the Dimensions
shelf.