Intro
You can create U.S. maps in which users can drill down on states to see values by both county and zip code. For example, a U.S. map may show sales for western states, as follows: In this map, a user could click on the state of Oregon to show the sales for all of the counties in Oregon: He could then click on Multnomah County (the small dark red county containing the city of Portland) to show sales by zip code within that county: To enable state and county drilldown, you must first create a DataFlow data source that joins two data sources: the data source with the values you want to show and a data source with state, county, and zip code information. With this data source, you can create a U.S. map with state and county drilldown enabled. Video - Creating a Map Drilldown to ZipCreating the DataSet
The first step in building a map with drilldown is creating a DataSet with your values matched to the appropriate states, counties, and zip codes. You can do this by using DataFlows to join the following input DataSets:- The master DataSet that contains the values you want to display. The DataSet must contain a column with zip codes.
- A reference DataSet containing columns with states, FIPS county codes, and zip codes. The names of the columns in this DataSet must be different from those in the master DataSet, or the DataFlow will not run successfully.
- In Domo, click Data in the toolbar at the top of the screen.
- Click SQL in the Magic Transform area at the top of the screen. The Create DataFlow page opens.
- Enter a name for the DataFlow in the Name field.
- (Optional) Enter a description for the DataFlow in the Description field.
- Under “Input DataSets,” click Select a DataSet.
- Locate and select the master DataSet (the DataSet that contains your values).
- Click Select a DataSet.
- Locate and select the “Zip2Fips” DataSet.
- Click Add Output DataSet. An Output DataSet dialog appears.
- Enter a name for the output DataSet in the Output DataSet Name field.
-
In the Output SQL field, enter the following SQL, replacing master with the name of your master DataSet and zipcode_column_name with the name of the zip code column in your master DataSet. Also, if you named the reference DataSet anything besides “zip2fips” in the previous set of steps, you will need to change all instances of “zip2fips” to that name.
select master.*, zip2fips.`STATE` as 'State', zip2fips.`FIPS`, zip2fips.`CNTY_NAME` as 'County', zip2fips.`ZIP` as 'ZipCode'from master
join zip2fips
on zip2fips.`ZIP` = master.` zipcode_column_name `
- Click Done.
- Click Save and Run. Domo now attempts to create an output DataSet that joins the master and “Zips2Fips” DataSets. If the attempt is successful, the new DataSet is added to your DataSets listing. If any problems are found (such as duplicate column names), a message appears indicating that the run was not successful.
Creating map drilldown
With your new DataSet, you can build a U.S. map with state- and county-level drill path.Note: You cannot drill directly from the U.S. map into a zip code map; you must include the state level as an intermediary step. For example, you would not be able to click on Oregon and bring up a map with zip codes; you would first need to open a view showing the counties.
-
In the page where you want the new card to appear, click
then select Create New Card.
- Click Existing Data.
- Locate and select the DataSet you created in the previous set of steps.
- Click Select DataSet. The Visualize your Data screen appears,
- Select United States as your chart type.
- In the value menu, select the column that contains the values you want to display.
- In the category menu, select State.
- Click Save & Finish. The card is saved to the card page.
- Click the new card to open its Details view.
- In the Options menu, select Edit Drill Path.
- Click Add a view.
- In the category menu, select FIPS.
- Click Save this View.
- Click Add a view.
- In the category menu, select ZipCode.
- Click Save this View.
Note: If you have just state level information and use the US map card to filter to a specific state, the entire US map will appear, but only the state you have filtered on will be highlighted.
Note: F or a US map to use State/County/Zip Code drilldown, it is important that the state column in the DataSet for the top-level card use a two letter state abbreviation category. The state column MUST be named “State” or “STATE.”