Download Set Analysis Cheat Sheet

x

The Slope Graph

If you have a passion for visual analytics, you have likely read some of the classic books written by Dr. Edward Tufte.

In his book, The Visual Display of Quantitative Information, Dr. Tufte introduced a slope graph.

Slopegraphs compare changes in values over the ordinal scale for two time periods.

 

Slope graphs not only indicate a positive or negative trend but also show exact value along the scale.

 

Qlik Sense lacks a slope graph, but with Set Analysis, you can easily create one.

 

Create a line chart and use Set Analysis with date range expression as an element set in the set modifier.

 

Let’s start with a basic Set Analysis expression to calculate changes in Margin value between the year user selects and the prior year.

sum({<Year = {“>=$() <=$()”}>} Margin)

 

Within the first dollar-sign expansion, add expression =max(Year)-1 .

sum({<Year = {“>=$(=max(Year)-1) <=$()”}>} Margin)

 

Note: An expression within a dollar-sign expansion always requires an equality operator(=)

 

Now, in the second dollar-sign expansion, add =max(Year)

 

Add {1} as an identifier to show all country graphs.

sum({1 <Year = {“>=$(=max(Year)-1) <=$(=max(Year))”}>} Margin)

Use this expression in a line chart with Year as a group dimension and country as a line dimension to create a slope graph in Qlik Sense.

If you want to show the Y-axis label to display the year range, create a dynamic label dynamically.

=(max(Year)-1) & ‘ vs ‘ & (max(Year))

Remember to add = sign before adding the expression in the label expression.

 

The last step is to add a color expression using pick and match functions.

 

Dark grey color for the country selection whereas light grey for all other countries.

pick(match(Year, max(Year), DarkGray(), LightGray()), DarkGray(), LightGray())

That’s all you need to create your Slope graph in Qlik Sense for effective storytelling.

-Shilpan

 

OR

Let us help you take your Qlik skills to the next level!

Become a Pro Member

If you enjoyed this article, get email updates (it’s free).

* indicates required
About the author

Leave a Reply