In this tutorial I will go over a quick calculation I made last week that dynamically sizes words based on rankings.

I wanted to do this so that the top performing states would really stand out on the dashboard. The issue is that if you change font in tableau all of the words will change size so I wanted a calculation which could change the size of each BAN automatically and separately.

Making the calcs

Lets start by making a simple table I put sales on the text shelf and state on the rows. I then did a quick table calc to show the rankings for each state by sales and ordered them in an ascending fashion. I have also filtered by the top 10 state by sales just to reduce clutter in the view.  

Now we can utilise the sizing shelf to change the fonts of each rank dynamically. I thought of two different ways of doing this. The first and easiest was simply to calculate the inverse of the rank, this means that Rank 1 will be given the highest value in this calculation and thus when we put it on the size shelf it will appear the biggest.

The other alternative is to use a much more manual calculation which gives us a bit more control over the sizing of the numbers in the view. This calculation might look something like this, you’re essentially assigning each rank a value to size it by. These values could be changed as you see fit.

The final alternative is probably just to size by sales, but if you have massive outliers in sales this would obviously make the font sizes quite weird, maybe it works in one case and doesn’t work in another, either way its always nice to have options.

And that’s about all for this blog, its quite a niche tip but I found it useful for my purposes so maybe someone else will too.

If you find some uses for this tip, please let me know or if you innovate on it I’d love to see what cool stuff is possible, I can be found on twitter @thenumberstim.

Cheers for reading!