Robert Kosara has an interesting post up on EagerEyes
where he uses Tableau to visually highlight trends in states' presidential party preference. Two readers suggested that the states should not be arranged alphabetically, instead clustering them in some fashion that groups like-minded states.
A reasonable approximation would be to sort states according to the percent of time they voted for a given party. To break ties we can sort by the latest year that each state voted for that party. Here's the resulting image:
The sort order is based on party preference aggregated over time, which is difficult to perform in the view above since time itself is a dimension; we must first sort in the absence of time, and allow that sort order to persist as we evolve the visualization. To create the view above let's start with a simple view of party vs. state.
Next we define a calculated field 'CntPartyLastYear' that will aggregate the count of a state's party preference over time, along with the tie-breaking value of the most recent year a state voted for each party (converted to a fractional value).
- CntPartyLastYear: COUNT([Party]) + MAX([Year]) / 10000
Place this field on the "Text" shelf and create a table calculation for the percent of a state's total vote to see the split in party preference aggregated over time:
Finally select a column (I arbitrarily chose the Republican party) and sort. This sort order will persist as we modify the visualization to create the final image. Remove 'CntPartyLastYear' from the Text shelf. Move 'Party' from the Columns shelf to the Color shelf, and place 'Year' (discrete, all values) on the Columns shelf. Note that this final step now incorporates time without disrupting our sort based on aggregation over time.
If you'd like to experiment, here's the packaged workbook (TWBX). We offer a free trial that you can quickly download and install to play with the data analysis yourself.