Creating alternating measures
My latest #BestNewTableauSkill reflects on a technique I used within this week's Makeover Monday during which people were challenged to visualise the sustainability of public transport around the world.
I wanted my visualisation to replicate a Bus Route with each city alternating to the left and right of a centre line, effectively representing each city as a stop on a route. I hoped this would relate the visualisation to the theme of the data and as such increase engagement with the analysis; here is how I did it:
Ensure you have a field that orders your data
In my Makeover Monday example I wanted cities ordered by the most sustainable so I created a RANK_UNIQUE table calculation:
RANK_UNIQUE(max([Sustainable Cities Mobility Index]),'desc')
Odd or even calculation
Create a calculated field that assigns each value to an ‘Odd or Even’, i.e. left or right of the centre line:
Combine your odd or even calculation with your measure
Using the ‘Odd or Even’ calculation amend your measure to create alternating negative and positive values:
if [Odd or even] = 'Even' then max([Sustainable Cities Mobility Index]) else -max([Sustainable Cities Mobility Index]) END
Place the amended measure value (step 3 from the steps above) into columns and your dimension into rows and sort your dimension by your measure value (if you required a sorted alternating viz).
If you would like to view and download my Makeover Monday viz to allow you to replicate the technique the link is below: