Friday 27 May 2016

Qlikview Best Practices - 1 - Cache Friendly Expressions

This is the first post of the Qlikview Best Practises series in this blog. In this series of blog posts I aim to share the best practises I personally use and highly suggest in Qlikview Projects.

An expression in Qlikview is used to decrease the size of the data you are discovering. This is similar to what we use in Ansi sql as “query”. Initially you have the full data set to analyse but when you apply an expression in your chart you will restrict the rows available in data set. For example if you want to display sum of sales information for one region, you would use the following script:
Sum({$<Region={‘America’}>} Sales)
Expressions have a huge affect on chart calculation time. However once Qlikview calculates an expression it saves the result in a cache along with the state. This means that when you make a selection and chart does the calculation, for that selection and expression, Qlikview creates a cache slot. When you make another selection, then Qlikview saves it in another cache slot. So, Qlikview creates a cache unit for every expression and selection state. It even creates a new cache for expressions typed differently. Any extra space, character capitalization difference in expressions will cause a new calculation and a new cache slot.

Making sure you always type the same expression in the same way is a hard to achieve task and cost of not doing so is considerably high. To mitigate this you can store your expressions in variables and load them from an excel spreadsheet. By doing this you will make sure yourself that you are using the same expression for the same purpose across your documents.