My first Tableau challenge was about visualizing a chart that was availaibe in the Development in the Americas (DIA) publication from IDB. This is one of the flagship publications for the Bank and I took it as a chance to learn and try to do some extra analysis.
But first I had to coordinate with the specialist in order to get the same data he used to build my makeover. I then used the Tableau Data Reshaper for Excel and it was very useful to massage the data for Tableau.
Once the data was ready it was time to start testing. And I did a lot of tests and tried a lot of things. The best of Tableau is, you can really use it as a sandbox and play with the data.
Basically the story to tell was how different countries adopting different policies can affect an industry, in this case the rice production industry in Argentina and Costa Rica. If you ar curious, here is the original chart from the publication:
For this post I want to focus on how I used a parameter to allow shifting the main visualization component, the timeline. The dataset contained two indicators: (1) Rice Production (2) Production index by Hectare. So I wanted to give users a chance to explore both.
After loading the data in Tableau, I then created a parameter “Select the measure”:
As you can see I used the Float data type and gave 1 and 2 values to my measures.
Next I’ve created a Calculated Field (which I named Measure Selector) to give function to the parameter. Here it is:
CASE [Select the Measure]
WHEN 1 THEN SUM([Rice Production])
ELSE AVG([Production index by Hectare])
Translation to humans: Hey Tableau let’s give some function to the “Select the Measure” parameter. When user’s select the one related to value 1 please show the sum of Production. If any other value is selected, then please display the average of Production index by hectare.
To build the timeline it was just dropping the fields:
- Countinous Year to Columns
- Calculated field Measure Selector to Rows (this is the key to make the view dynamic based on the selected parameter)
- Country to Color (Argentina blue, Costa Rica red)
- SUM([Production index by Hectare]) and SUM([Rice Production]) to Detail (so I could use them in the tooltip text
After some text and table formating I had my timeline ready. I then added it to the dashboard:
The “Select the Indicator” parameter on top right is the dynamic element I was talking about. Users can flip the main component to interact with the data.
I also added a nice feature at the bottom that shows another flavor of the data. It compared the production of the year against the previous year. But that is a topic for another post.
How do you see the end result of this viz? Does it achieve the goal of telling a more compeling story then the original?