Two questions from business users that will probably sound familiar to most QlikView Developers:
“We currently use this report. Can you re-make this in QlikView?”
and
“Our graphics designer came up with this dashboard. Can you do that in QlikView?”
Quite often you’ll find the answer to be yes. Although admittedly, you often may also want to suggest another approach, especially when asked the first question.
Recently I was asked if the following chart could be built in QlikView:
As you can see, this chart compares relative-to-total amounts for two periods. There is a vague area that connects both bars and kind-of-but-not-so-much shows the change between the periods. I had to think a bit harder before responding to that question…
At first I thought, maybe I can just create a line that attaches both bars and create it that way. Well, that didn’t work. But, fooling around in chart properties of both the bar- and line charts, I found a way to do it. I wouldn’t recommend this chart for it is rather hard to make, not that fancy and really doesn’t say much…
…But as the client explained, the goal of this dashboard was to impress rather than inform. And hey, the customer’s always right? Right?
So, here’s how it’s done.
Since it’s impossible to do this in a single chart, you’ll have to put two charts on top of each other, and make the top one 100 % transparent in the colors tab.
First, you create a stacked, horizontal bar chart. In this example, I have two dimensions: Year and Brand, in that order. I used the following expression:
The TOTAL qualifier is used in combination with the Year field to have the percentages per year in every segment of the bar. Also, the set-analysis is to make sure always exactly two years are shown. Fortunately, that was the requirement as this trick doesn’t work with more than 2 years. (or rather, it becomes a lot more complex)
To create the values in the chart, in the expressions tab, click , select ‘text color’ and enter ‘white()’ as the expression. Also in the expressions tab select ‘Values on data points’. In the presentation tab, create an open area between the bars by setting the cluster distance. Select ‘Plot values inside segments’ to show the values inside the bar. In the Axis tab, hide only the X-axis. In the number tab, select fixed to <2> decimals and ‘show as %’. Furthermore, get rid of all captions, titles and other stuff that isn’t used. You should now have something like the desired image, except of course for the middle, vague section that connects the two bars.
Now, let the ‘magic’ begin.
Copy the current chart for you want to use the same dimensions, expression etc..
Go to the chart properties. In the general tab, select line chart. On the dimension tab, deselect ‘Show legend’ for the Year dimension, you don’t want to see two legends for your years. In the expressions tab, make sure the expression is shown as a line, without values on data points. In the style tab, select the fourth option, area chart. In the colors tab, select the colors you used one by one and then, in the ‘color area’, change the transparency. Finally, in the layout tab, make sure your border width is 0 points.
Now the last bit is to size them properly and place them exactly on top of each other. Besides the mouse, you can use the keyboard or the settings on the caption tab. Et voila!
You can download an example application through the link below.
26 Comments
This is really awesome! I saw it on twitter a few days ago and already used it into a dashboard at a client – it was a hit.
Thanks for sharing
That’s awesome! Very happy to hear it’s useful and appreciated.
Hello, I am Brazilian and working with QlikView. Incredible thought his example. Congratulations and thanks for sharing.
You’re very welcome Anderson! I hope you will be able to use it!
Hi Wesley,
Very nice presentation if you want visualize the change between years and a part to the whole.
I will definitely be using it in futher dashboards.
Hi Wesley this is excellent! Very clever use of QV charts!
Thanks for sharing!
hello Hesley,
thanks for the post, I am very interested.
You can republish the sample file because Dropbox does not allow downloading it?
Thank you
Paul
Hi Wesley,
Great work done. This is what we call “Creativity”.
Just a suggestion, add “Brand=” like below in all denominator expression:
sum( TOTAL {$}(Value))
This will prevent converting a single band value to 100% whenever user select any single band from selection box. This expression will bypass the band selection from denominator and show real value of band when selected.
Thanks
Ankur
“sum( TOTAL {$}(Value))”
I am trying to add compelete expression but whatever in the set analysis in not coming up in my comment. You just need to add “Brand=” in your set expression to make this work.
Hi Ankur,
Thanks, I’m glad you like it.
Your suggestion is certainly valid, if you always want to show all brands.
In this example, however, there’s also the possibility to select brands, and than show parts to the whole.
Kind regards,
Wesley
Hi Wesley,
Thanks for your reply.
My suggestion is valid only if someone select brand name from selection box. If you are displaying the data for all brands then there is no need to add any thing in set expression. Currently the value for A brand is 8.64% for 2013 and when somebody select A from list box this value get converted into 100%. To prevent this converting to 100% you need to put “Brand=” into your set expression.so that it stick on 8.64%.
Regards
Ankur
Nice! concise explanation.
The file is not there… could you please upload the file or send it to my email?
Many thanks
Yas
Hi Wesley,
Looks pretty good! I want to give it a try, but it’s not possible to download due to some download issues. To be more specific, your dropbox account is temporarely unavailable 🙂
Is it possible that you send the qvw to my email address? Thanks in advance!
Regards,
Frank
Hi, how can I show only lines that connect the bars without the filling colors
Thanks
Regards
Link is broken.. Can anyone send me the qvw?
It’s fantastic!!!
Are there another link to download the exemple?
Regards,
Hi Wesley,
Link broken any other way to download the sample. Thanks
Hi the link is broken, can you please re-upload?
This is a fantastic chart! I have tried to replicate it following the instructions, but I can’t figure out what I need to change. Can you send the example file? The link just gives a message about too much traffic, which can only be because the chart is so awesome! Please, please, please? Thank you, thank you, thank you.
Hi Dena,
I have changed the location, it should work now. Happy Qlikkin’!
I also have not been able to download the example qvw. Can you fix and/or assist?
Hi Richard,
I have changed the location, it should work now. Happy Qlikkin’!
Wow, absolutely fantastic chart…..Thumps up for you Wesley.