Maintaining Color of the Dimensions in QlikView

Recently at work, someone had a problem in assigning a consistent color to the dimension.

For example, if  a table consist of Products and Revenue then each Product should maintain a consistent color, irrespective of the selection.

Suppose the table is as follows :


A pie chart for the above table should maintain consistent colors for the Products i.e. BabyClothes should retain RGB(141,170,203),Sports should retain RGB(252,115,98) and so on


My attempt is to resolve this in few different ways,

One way is to write a simple If statement in the Chart expression/Background color


This solves our purpose but nested Ifs are not recommended in the expression because it may slow down your dashboard.

Use of Inline Table in Script

Another way is to have an Inline table in your script and reference the RGB from your inline table.

Inline table for Product color and corresponding expression/background color will look like the following :


This is a good solution, but if these colors need to be implemented in multiple dashboards then Color_Inline table need to be created in each of the dashboard.

Inline table in Text file and Include option

A better solution will be to put this Color_Inline table in a text file and use “include” in your script editor. In this way you can create a global solution and these colors can be maintained at the organization level and can be utlilized in multiple dashboards.

Your include statement will look like


You will use the same Expression/Background color in this case also.Only difference is instead of using the Inline table from the script, you are using from the text file.

So the different ways you can maintain colors of your dimensions are :

  1. Use nested Ifs – Not a good solution, use this only if you have very few colors
  2. Use of Inline Table in the script –  better solution
  3. Inline table Table in Text file and use of Include – Good solution , should be used if you want to create enterprise wide solution.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.