Maps, Maps, Maps!

Sayantani Mitra
CRM Analytics
Published in
6 min readFeb 5, 2024

Maps tell a story better than most chart types in the right context. Say, when using countries (map) for country-based data, or plotting US States as bubbles (bubble map) for or state-based data plotting geolocations (geo-map) for any of the other scenarios when we want more granular charts.

These maps are all possible in CRM Analytics! How cool is that?!

For this blog, however, we will concentrate on country-based maps and then perform some simple bindings/interactions to change the map-type and update measure columns.

The challenge

This challenge was formulated as my first-ever challenge creation for workout-wednesday.com. The gist of the challenge states that we have to create a map chart type using bindings/interactions to update the map-type, and the measure columns used for plotting the data. The challenge is posted here.

Please note that the data in this case is not the usual taxi data we work with but a worldwide energy dataset.

Solution

After loading the csv file into CRM Analytics, let's break this down into steps!

  1. When using bindings/interactions they can be done only in dashboards and not lenses. So we start by creating a new dashboard.
  2. Next, we use Create Query from the dashboard and choose the associated dataset with the energy dataset.
Select the energy dataset

3. Then choose the compare table from the widget/lens section that opens and label the query for ease of finding it later. We can do without compare table as well because this is a simple map. But the beauty of using a compare table is that the column headers and aliases can remain streamlined — this is a best practice for naming conventions.

4. We now group the data by country. Add measures to say max of one of the energy data fields (We will use bindings/interactions to change the measure field). In addition, we can add GDP, population, etc. Even small contexts like these in the tooltips add value to the dashboard and thus the user.

Adding requisite fields to the Compare Table

5. Once done, we will update the column header and alias using the edit column feature from the individual columns dropdown menu.

Edit this Column
Edited Columns

6. As stated earlier, we base the map on Consumption, not the GDP or Population. Thus, the last two fields should be hidden. Again, we click on the caret next to the column and hide the fields.

Hide Column
Tooltips including hidden fields

7. We now change the table to a chart mode and then select Map

Choose Map
Map Selected

8. Add the widget to the dashboard, remove the legend header, and update the tooltip options.

Legend and Tooltip Options update

9. We can update the colors of the map as well. Low is green and red is high for example.

Conditional Formatting Update

10. Next, let’s look at the different map-types available. For this, click on the map from the widget properties, and then under map-type we can see World Countries, US States (not applicable here), Americas, Europe, Asia etc. We will bind to this for updating the map-type to focus on a specific region. There are two ways to do this. One would be to create a dataset with these map types and upload it as a csv or write each map type in the static step. The csv dataset is a great solution if maps are a commonly used part of the product/platform being developed. But if it is a one-off thing, then you can use a static binding. We will do a static binding for the measure columns. Thus, let’s use the dataset uploaded as csv for this. The API names of these map-types can be found in the Advanced Widget section under “map”. Select Advanced Editor either from the Widget Properties or the selections on the bottom right of the map. Both options are shown in the images below.

Map Types
From Widget Properties
From the Widget itself
Highlighted section says what the map-type is

11. Note that the name we see on the Map-Type in the UI is what is present in the Advanced Editor.

12. Thus, our dataset for Map-Type will look something like the below

Map Types as an uploaded dataset

13. Now, create a list selector, and select this map-type dataset. Update the Selection Type to “Single selection (required)”. Even when using a static step, the Selection Type should be “Single selection (required)”.

14. Next use pick initial values and select which choice of the map should be the default. Say, we choose “World Countries”

Map Type — Selection Type

15. Now for the binding/interaction, click on the advanced editor as we did above, and using the binding/interaction feature, select the list-selector step under Source Query. For Source Data, the Data Selection will be cell, Row Index will be 0 and the column will be Map_Type. Next, our interaction type will be selection. Thus we can see a binding/interaction auto-generated for us! As we can see, the interaction result says “World Countries” since, for this part, we selected this as our default value.

Where to add the Interaction

16. Copy this binding/interaction. We now replace the “World Countries” highlighted in the image above with this binding and within double quotes.

Interaction and Interaction Results in the Widget

16. Similarly add the binding/interaction under the map in the query section.

Interaction and Interaction Results in the Query

17. Now save the Advanced Editor.

18. The last part of this dashboard is adding the different measures as a binding/interaction. This will be a static step with two columns that will contain the measure display and API Names. And the query Selection Type will be “Single selection (required)”.

19. Let’s start by giving the static query a name, Utility Type. Add a Display Name column that will be what the user can select from the filter — This is the name we want for each of our columns (need not be the exact API Name). And then add a measure column for their corresponding measures.

Static Query for the Measure Column

20. When we use Advanced Editor on the static query, we find that it has created 2 fields for us. One for the field itself, Measure2__field, and one for the function, Measure2__func. Since our function in this case will remain static, we will use the field itself.

21. We follow the same method as we did for map-type to create a selection interaction and then simply replace the column name in the Advanced Editor Query for the map widget.

Section of the Query to replace
Replaced with the binding/interaction

22. Not required but we can add filters for country and year as well. Both of which can be multiple selection listselectors or global filters.

Final Visualization

Interactive Maps

--

--