Let Your Data Race

Lorenzo Vercellati
Data Pied Piper
Published in
5 min readMar 15, 2021

During the last two years it has been not so unusual viewing infographics with racing bar chart to show the evolution of data along time. The topics have been a lot, from football players goals to Nasdaq and obviously also COVID-19 related. The tools used to build this infographics have been a lot.

Maybe you were fascinated like me by this infographics and you asked yourselves if it’s possible building the same type of visual effect with Power BI. It could be a good idea for some data storytelling proposal!

I have good news for you: it’s possible! And it’s really simple.

I will used my usual English Football History dataset for this demo. I will transform a simple bar chart, showing the number of titles won by each English club since the first edition of the First Division in 1885, in a racing one.

Starting Point

This is a really simple chart, but it works very well: it’s clear and easy to understand. Understanding which are the best clubs in England is really immediate. Well, but we want add movement to this chart. Play Axis custom visual is what we need. We can find it for free in the custom visual marketplace.

Going to the market

We download and add it to our report, setting season as field of the visual.

We can also set some properties of this visual as the Animation settings selecting the desired speed in ms:

Now we can test it.

Well, Play Axis works fine, but we need to change something in the bar chart. We need to show the cumulative number of titles won by a club since the first season to each season we select and so we have to add a new measure to our report. This measure is really simple: we can use the original measure, using the CALCULATE function to manipulate the context. In the second parameter of CALCULATE we choose the context we want to count the titles in the right way. The measure will evaluate [Titles] considering all the values of Seasons[Season] column where the values is less than the selected season.

Cumulative Measure

When we have the measure, we can use it in the bar chart and test the new version of our report.

We are on the right way but it’s a long road!

The chart looks better, but it’s not the final result we want. The club labels are static because of the total bars on background, so we haven’t the real perception of movement of the standings along the years. We must work on interaction between Play Axis and the Bar Chart. So we click on Format tab and we activate the Edit Interaction function.

We want change the option from Highlight to Filter, to erase the total bar from the background.

Form Highlight interaction to the Filter one

A new test tells us we have done a step up but at the same time we have done a step back!

Now we have the movement, but we are unable to correctly understand the evolution of the bars and to follow one team in its evolution along the years. We need to distinguish each bar from the other ones! We need different color for each club. The best solution to obtain this effect is working on Data colors property adding a conditional formatting.

But which option can we use for our target? Color scale and Rules do not fit our needs. The solution is having a field in the clubs table with the color we want use for each team. For this field we can use HEX values.

When we added this field and we populated it, we can use the right option for manage the data colors:

And the result looks right better!

Almost at the end

Now we need just to add data labels to have the final result: our bar chart race!

Let your data race!

It was easy, wasn’t it?

Well, I hope this example could show you not only a nice tip but also explain — another time again — that Power BI is not only a wonderful tool for analytics but for data storytelling and presentation too.

--

--

Lorenzo Vercellati
Data Pied Piper

PowerBI Solutions Architect, SQLSat DIAD PPWT Speaker, Medieval History Graduated, Football Addicted, HomeBrewer, Springsteen & Pearl Jam Fan