In November this year the next President of the United States will be elected and the election campaigns are already in a hot phase. Each candidate and each party claims to be the best one and often refers to his or her good work in the past. However, the numbers often paint a different picture than the glowing speeches of the politicians. If you really want to evaluate a president or a political party by hard numbers, an intuitive and clear visualization becomes indispensable.
The new ElectionParty Extension for Lumira completely fulfills this purpose: It shows, for example, state expenditures or the number of unemployed persons over time as a normal line chart and adds the presidency periods with a different color for each political party in the chart’s background.
In this context the Lumira Quandl Connector Extension is perfectly suited to obtain the right data for your visualization because it provides easy access to a wide selection of economic data which can be imported into Lumira with just a few clicks.
In this blog post, I will explain how to use the ElectionParty Extension in combination with the Quandl Connector in order to create meaningful visualizations.
Install the ElectionParty Extension
- Install the QuandlConnector Extension
(Optional) Register for a quandl.com account to get an API key (only needed if you want to access premium datasets or exceed the usage limits by consuming a lot of data in a short period of time)
2. Create new document and import the example presidency sheet
In Lumira select File>New>Text and import the example presidency sheet provided as an attachment (scroll down to the bottom of the post), which contains the presidencies of the USA since 1949 including president name and political party.
3. Create a date hierarchy for the imported data
On the “Prepare”-screen click on the gearwheel of the “Year”-column and select “Create a date/time hierarchy…”. Select “Date” and make sure that for “Year” the correct column is assigned and for the other dimensions the value “None” is selected in the dropdown menus.
4. Use the Quandl connector to import the graph data
To use the Quandl connector you need some Quandl Code for the dataset that you want to import. Go to quandl.com>Browse Databases to find a suitable dataset. Copy the Quandl Code from there.
In this example we will use the “Unemployed” dataset with the Quandl Code “FRED/UNEMPLOY”.
Now go back to the “Prepare”-screen in Lumira and select Data>Add new dataset and select Quandl Connector as data source. Click “Next” and paste your Quandl code into the corresponding field. Also enter a name and select “Selected Date Range”.
Enter 01/01/1949 for the start date and select the current date as end date.Make sure to select “Annual” for “End of period” because the table of presidencies also uses annual time periods. If your selection for “End of period” does not match the time periods in your presidencies dataset, you won’t be able to join the two tables.
5.Create a date hierarchy for the imported Quandl data
Go to the “Prepare”-screen and open the imported Quandl dataset. Click the gearwheel icon of the “DATE” column and select “Create a date/time hierarchy…”. Columns for “Year”, “Quarter”, “Month” and “Day” have been added to the dataset. You can delete the columns “Month”, “Quarter” and “Day” because you won’t need them for the next steps.
6. Merge the datasets
At this point you are ready to merge the presidencies dataset and the Quandl dataset.
To do this, select the presidencies dataset in the “Prepare”-screen and click the merge icon located at the toolbar in the upper right-hand corner of the screen. If you have done everything correctly in the previous steps, the “Suggest”-button will match the generated “Year”-columns of both datasets with a compatibility of 100%. However, you can also match them manually by selecting them from the column lists.
Press “Merge” to perform the join.
The result will be a table containing multiple columns for “Year”, “DATE” and “Calculated Timestamp”.
Unfortunately you cannot avoid these duplicate columns, but if it is an issue, just click on the button in the upper right-hand toolbar to hide them. The required columns are “Year”, “Party”, “President” and “Value”.
7. Create a measure
Click the gearwheel icon of the “Value”-column and select “Create a measure…”
Switch to the “Visualize”-screen and select the ElectionParty Extension.
Assign the Measures and Dimensions as follows (make sure to assign them in this sequence):
If you have done everything right, the result should look quite similar to this: