Hello everyone and welcome to our first post of the year. Today, we’re going to work with a simple data set from the Barclays Premier League and see how number formats, simple visual cues and other chart options can help us present better rankings:
But before that, let me take a minute to share a couple of things I’m really looking forward in 2016. As Qlik fans and data enthusiasts, maybe you will relate to some of them:
- Masters Summit @ Milan: The dream team will be offering new workshops with the Qlik platform in one of the most iconic cities of the world… Am I the only one excited?
- Three long-awaited book titles in my list are finally coming out this year:
- Data Visualisation: A Handbook for Data Driven Design, by Andy Kirk
- The Truthful Art: Data, Charts, and Maps for Communication, by Alberto Cairo
- Mastering QlikView Data Visualization, by Karl Pover
- Deploying more projects with QlikView and R: I’ve been working in small apps that mix QV with machine learning, predictive models and text mining in R and the results have been amazing (more posts about this topic in the following weeks). However, I’m pretty excited about implementing them in large scale.
- Seeing how Qlik Sense evolves: I have to admit that my inner System Administrator fell in love with Sense from the very first minute. However, as a developer, data analyst and especially as a designer, I think that it still has room to grow. Nevertheless, I’m eager to see how this platform matures. I think 2016 will be a crucial year for Sense.
Becoming a Qlik Luminary: Ok, we can take this one out of the list already. It looks like my blog, my Twitter account (which you should totally follow) and writing a book about QlikView while selling and deploying projects for all the Master Resellers in the country for the last 6 years are not reason enough to get that title. Man, I’ve trained over 250 students in the art of developing QV apps! But maybe next year…
C’mon, maybe even Leo might get an Oscar this year! But anyways, on to the post. Today’s data set is pretty simple, we have the best 6 teams of the Premier League and how many points they scored in the last two seasons. The idea is to display the rankings of both tournaments and highlight the movements between them. [Download all the materials here].
Even though the number of points is a valuable metric by itself, the way this competition works makes the rankings (the way one team compares to the rest in the current season) more relevant. For instance, let’s focus on Arsenal for a minute. As you can see, even though they scored less points in the most recent tournament (75 against 79 from last year), they improved their position by going from the fourth to the third place.
Of course, the number of points can tell interesting stories like the competitiveness of the league or highlight the gap between the best and the worst teams, but for now, let’s focus on the problem in hand: how to manage rankings and their movements.
The star of this game is the rank() function, which returns the relative position of each element based on the expression used as parameter. But let’s see it in action.
This expression calculates the points for the 2014/15 season:
If we wrap it with the rank() function, the result would be an integer representing the overall position of that team:
Note: To be precise, rank() returns a dual value (text and number). There might be some cases where two teams score the same number of points, so the result would be displayed as “3-4”. In order to manage these exceptions, you can rely on the second and third parameters of the function.
Once we have built these columns for both seasons, it’s time to highlight the movements between them by creating a new calculation that subtracts the rankings:
Even though this table shows all the metrics we had in mind, we can improve it by altering its design. First, let’s create a hierarchy in the data by highlighting the most relevant figures, in this case, the last tournament available. Go to the Expressions tab, select the third and fourth columns and change their Background Color:
While there, change the Text Format to bold as well:
Season 2013/14 will serve as context for our visualization, so we’ll leave it as it is. * This doesn’t mean that these numbers are useless! Remember that context always enriches our analyses.
Now, the Movement column will suffer two changes:
1.- Use the Visual Cues tab to display improvements in green and deteriorations in red.
2.- Change the number formats so that, instead of the classic + / – signs, our table uses arrows: ▲ #,##0;▼ #,##0; ► 0 (The three parameters are positive numbers, negative numbers, and zero).
And finally, add some chart junk:
Sorry, but I couldn’t resist:
Moving on to the next section. Most of the features of the bar chart are pretty straightforward, so let’s just focus on the interesting part: the ranking movements in the graph’s axis.
The trick here is to add a second expression. However, instead of displaying it as a bar, line or symbol, you have to check the Text on Axis option:
The expression is the same we used on the table but now, we have to format the number ourselves using the num() function:
And the same goes to the Text Color and Format!
Done! Our visualization is now complete.
Side note: When you’re working with rankings, Slope Charts can be a great option too!
I hope you find these tips useful. Remember that little details can transform a boring QlikView app into a real data discovery platform that promotes insights and supports decisions.
Thanks for reading and don’t forget to follow me on Twitter > @QlikFreak. Until next time!