Adding the switch button
Section two is a little more complicated.
We are going to use two visual (Shape Map and Table) and four images to switch between those visuals.
To add the images select, Insert -> Image
For now keep the switch on and off images apart and with the same size.
The Map visual
In the the US map we want to show the State color intensity proportional to the population of the census year.
Select the Shape Map visualization
If this option is not available in your Visualization bar, update Power BI desktop to the most current version or look for Shape Map in the preview features option.
For the Location drag and drop the state_name column from the States table.
For the Color Saturation select the total_population measure
Finally, rename the selected visualization columns state_name-> State, total_population-> Population.
The Table visual
It is important to keep the Map visual and the Table visual apart, in the same way we did with the images.
The table needs to show State Name and selected year Population, percent compare to the total US population, population change from the previous census and the change percentage.
We add the table visual and the necessary columns and measures.
To format the table select the Alternating rows Style
Change the conditional formatting for Population, Population Change and Change % using the color_pop_change calculated measure (you will need to do this change one column at the time)
final result
The switch button functionality.
To be able to change between map and table using the switch on and off button we are going to create two Bookmarks. Each bookmark will show and hide visuals depending in your selection.
This approach is handy to save dashboard "real state" to later add the Top 10 counties population chart.
First, in the View Menu select Bookmarks and Selection
Add a new Bookmark called ShowMap, hide the Table and corresponding switch button image
update the bookmark
Create another bookmark called ShowTable, and repeat the process hiding the Map and showing the table
Now we only need to assign the Action for the switch on-off images to the corresponding bookmarks
Overlap the Map-Table visuals and the switch on-off images, for the final result.

















Comments
Post a Comment