A great way to provide your end-users added insight from a bar chart is to highlight a special dimension value.
What is a “special” dimension value?? For example, if you’re reporting on market share between your company and competitors, you should highlight “Our Company” on the chart.Â Stephen Few has a nice example on this topic in “Information Dashboard Design,” Chapter 6.
Another example would be if you’re a Product Manager and are looking at sales figures across various products in the line. By highlighting the specific product that you manage you can see where it stacks up against the rest … at a glance.
Imagine we really want to focus on Product = Alpha, and let’s highlight it with a saturated red bar:
So, naturally we need to figure out how to do this in QlikView, right?!
Controlling Background Color
Fortunately there is a nifty feature in the Expression Properties of the Chart object that allows you to dynamically control the Background Color of the bars. And because it itself is an expression you can use if-then logic or any other expression you can conjure.
Here I’ve chosen to use the red() function, but of course you can use any similar color function or rgb().
So this solution is just fine, except it requires that the dimension of interest be hard-coded into the expression in the chart properties. ThatÂ may be okay for static analysis (like the market share example above – our company vs. our competitors). But for something that could change frequently (like Product) it would be a much more sustainable solution to be able to dynamically control the dimension of interest.
Dynamically controlling the dimension of interest
One way to make the dimension of interest dynamic is to store it in a variable. And then drop an Input Box object on the page. In this example we’ll call the variable varHighlightedProduct.
Now with a simple change to the Background Color expression –>
if(Product = $(varHighlightedProduct), red(255))
we can use an input box to control the highlighted dimension.
Another way to dynamically control the dimension of interest
The variable method works well enough, but changing the value in the input box requires a little bit of typing. Wouldn’t it be easier if there was a list box object in which the end-user could just select the dimension value of interest?? (answer = “YES”)
To build a separate list box we obviously need a data field. That can be easily accomplished with a resident load. Let’s suppose the sales data are stored in a table MySales, and the dimension field for product name is simply called Product. Then our load statement looks like:
LOAD DISTINCT Product AS [Highlighted Product] RESIDENT MySales;
This will load the unique values of Product into a table called HighlightedProduct with one field, [Highlighted Product].
Next, modify the Background Color expression so that it’s comparing against the selection in [Highlighted Product] –>
if(ProductÂ =Â [Highlighted Product], red(255)).
(You could get fancier with this code…allow multiple selections, restrict the list box to a single value, etc.)
So now we have a very convenient way for the end-user (the Product Manager in this example) to switch the dimension of interest using a simple list box.
I hope you find this simple example useful. Let me know if you have other ideas around this topic!