Adding new measures.
This is a simple dashboard, just one filter (census survey year) and few calculated measures.
The measures are:
- Total Population
- Previous Year Population
- Change Percent
- Population Change
- Percent of US Population
also, there are two calculated measures to format and add additional information to the dashboard.
- Value color (Green if current year population is greater than previous year population otherwise Red)
- Most populated counties chart header (to show selected states)
To add a new measure, right-click on the US Population ACS5 table and select New Measure
the add the formula for total_population and select the thousands separator format
Repeat this process to add
prev_census_tot_pop =VAR PreviousCensusYear =
MAX ( 'US Population ACS5'[census_year] ) - 1
RETURN
CALCULATE (
SUM ( 'US Population ACS5'[total_pop] ),
'US Population ACS5'[census_year] = PreviousCensusYear
)
'US Population ACS5'[total_population] - 'US Population ACS5'[prev_census_tot_pop]
change_pct =
1 - DIVIDE ( [prev_census_tot_pop], [total_population] )
change_pct = 1-DIVIDE([prev_census_tot_pop],[total_population])
pop_pct =
DIVIDE ( [total_population], CALCULATE ( [total_population], ALLSELECTED () ) )
for the "formatting" measures.
pop_pct =
DIVIDE ( [total_population], CALCULATE ( [total_population], ALLSELECTED () ) )
for the "formatting" measures.
color_pop_change =
IF (
'US Population ACS5'[total_population] > [prev_census_tot_pop],
"Green",
"Red"
)
VAR SelectedStates =
VALUES ( States[state_name] )
VAR NumOfStates =
COUNTROWS ( Selectedstates )
VAR NumberOfAllStates =
COUNTROWS ( ALL ( States[state_name] ) )
VAR AllStatesSelected = NumOfStates = NumberOfAllStates
VAR StatesNames =
CONCATENATEX ( states, States[state_name], ", ", States[state_name], ASC )
VAR Result =
IF (
AllStatesSelected,
"",
IF (
NumOfStates > 5,
UNICHAR ( 10 ) & "(More than 5 States selected, see map or table for details.)",
UNICHAR ( 10 ) & "(" & StatesNames & ")"
)
)
RETURN
"Top 10 most populated counties" & Result
Is a good idea to add folders to organize the fields.
In the model, select one of the new measures and in the folder field type Measures.







Comments
Post a Comment