How to build an animated Bar Chart Race in Tableau Software

Most of us have encountered Bar Chart Race animations by the time you read me. Can we build it in Tableau? I would say YES and NO, It can be done but using the page shelf which is not available on the web versions of our dashboards.

Let me talk first about who inspired me to do this. John Burn-Murdoch, I invite you to follow him on twitter, deserves an award for building and sharing THIS:

The animation is so smoothed, catchy, I want to stay in it forever and ever. It invites us to know more about the rise and fall of those cities. And we can definetely hear a speaker voice behind this Bar Chart Race (Hans Rosling style).

In Tableau, we can use the page shelf to fake animation, each new value in the page field being a “frame”.

The page shelf

And we can use Tableau to display points, lines and polygons wherever we want! (Once we crack the code 🙂 )

Sooooo… we have everything needed to fake one! (and build anything we want in Tableau, but this is an other debate)


We will use a main dataset with the information we want to animate. In the example, I have four fields: link, year, category and value.

“data” sheet

We will use a second dataset with two fields to build each bars: link, point.

“bar” sheet

And, that’s the new thing, we will use a third dataset to fake each frame.

“frame” sheet

If you want to show a race by year and have monthly measures too, you can try an alternative and better version of this by skipping this third dataset and use the month and year field to animate the viz!

In Tableau, join this three datasets on link as a cartesian product.


What we want to do now is to display each bar at the right position regarding its ranking by year, for each value in category. We also want the bar to “move” from the current position to a next one.

Let’s begin the calculations!

anim_inter : usefull later for moving values


frame : usefull later for page shelf (if you have a real field, like month, it’s better!)


value_current : value for the current year

{FIXED [Year],[Category]:

value_next : value of the next year


value_inter : value moving linearly from the current to the next year (if you have real values, it’s better!)


rank_current : rank of the current year


rank_next : rank of the next year


rank_inter : rank moving linearly from the current to the next year


@x_inter : moving lenght of the bar

IF min([Point])=1 THEN 0
ELSEIF min([Point])=2 THEN [value_inter]1.0
ELSEIF min([Point])=3 THEN [value_inter]1.0
ELSEIF min([Point])=4 THEN 0

@y_inter : moving position of the bar

IF min([Point])=1 THEN [rank_inter]1.0
ELSEIF min([Point])=2 THEN [rank_inter]1.0
ELSEIF min([Point])=3 THEN [rank_inter]+0.5
ELSEIF min([Point])=4 THEN [rank_inter]+0.5

filter : to filter my top 10 if available


label : display labels on my polygons (you can display what you want/need)

IF min([Point])=1 THEN min([Category])
ELSEIF min([Point])=3 THEN str(int([value_inter]/1000000))+”M”

This last step is not perfect. Who am I to know if my values move linearly a year to an other? That’s why it’s better if you use real values instead of my value_inter.


Now it is time to visualize. You have to use @x_inter and @y_inter inf columns and rows shelves, frame in Pages, filter in Filters.

You have to use the Polygon Mark and use year, category, anim_inter in details, and Point in Path.

We will use the @y_inter again as a dual axis as a point Mark to display my labels.

You won’t see the bars because we need to configure the table calculations.

@x_inter will be computed as Year, and frame.

@y_inter will be computed as Category for rank_current, by Category, Year and frame for rank_next and restarting every Category.

@filter will be computed as Category for filter, Year and frame for value_next.

And… TADAAAA, a Bar Chart Race in Tableau using the page shelf commands.

page shelf commands.

I updated my first dataset to show information about population by countries by year and whitout modifying anything else:


  1. Hi,

    I tried to replicate this visualisation with my own data, similar structure (Month, Country and Sales) as in your example but I have trouble with these calculations:
    1. rank next – I cant get it to return the actual rank for the following month. I tried all possible options but it either gets me the rank for the country row below or ranks a country by sales across all months, without considering rest of countries.
    2. @x_inter and @y_inter – i cant repeat adding 1.0 after [value_inter] – tableau treats it as error in the formula

    Can you help?



    1. Hey Xenia! If you have troubles with the calculation, I recommand you to go step by step 🙂 Using intermediate worksheet for example. About 2., I think this is a data type error, you have to make sure every value in other conditions are float, by multiplying by 1.0 for example!

      Hope it helps.



      1. I tried to reproduce by steps but its confusing with actual data. Also couldnt understand the logic. Can you please explain the steps with reason in depth or point to an appropriate source to understand it.


      2. Hey Mayur! Sorry I was a bit short in time for this one. The main principle to get is that an animation is built thanks several pictures or frames. The main goal is to build those frames then. Each bars are moving so we need to calculate each positions, and use the “Pages” functionnality to animate it.


  2. Hi Ludovic,
    Amazing job! I nearly replicate this but I stuck with labels. I cant understand how you separate them(first with “Category” is over the bar, and second with “Value” is at the bar end) Could you give me any advice?


    1. Oh sorry Lukasz, it’s not clear in my blogpost. You have to use the filed “label”: display category on point 1 and value on point 3 🙂


    1. Bonjour Mohamed, de quelle calculs parles-tu ? Les techniques utilisées ici peuvent être assez complexes à comprendre et à reproduire pour des nouveaux utilisateurs Tableau 🙂


  3. This is AWESOME! Thank you for the excellent instructions–I’m not very advanced at all and I was able to follow the concepts and instructions. I only have one question: the animations shown on this page are movies, right? Not embedded Tableau vizzes?


  4. Hey Ludovic Great post !!
    Explanation is neat and clean. I am able to replicate it successfully.
    Just one question why you have used only 4 point. Whats the significance of it ?
    Again thanks for contributing to community.


Leave a Reply


You are commenting using your account. Log Out /  Change )

Google photo


Twitter picture


Facebook photo


Connecting to %s