Writing expression in QlikView is pretty straight forward to do and these expression aren’t just limited to calculations either. They can also control the visibility and style of your object, anywhere you can see the three dot … button means you can write an expression.
So where best to store them. Those new to QlikView maybe unsure why I am even asking that question. Surely you just write what you need into the expression editor and that’s that?
Well during early development that is exactly what you will do, cutting and pasting the calculations between objects. Once your dashboard becomes large and you need to think more about future development and accuracy you will need use another option like storing the calculations into variables and using those in your charts. There are three reasons for doing this:
Consistency. Because you’re re-using the variable you’re not going to miss a small difference in a calculation tucked away in some chart you though should have been the same.
Accuracy. Expressions only need to be changed once for the entire dashboard to be updated. This minimises the risk of making an update in the future but missing that one calculation tucked away somewhere. Expressions stored in variables can also reference each other which also means if one is changed in the future the new results will filter down though all the other expressions that rely on that calculation.
Performance. Did you know if you have what is effectively the same expression but written slightly differently (even as subtle as an extra space in the expression) QlikView will parse them independently? Keeping expressions consistent in variables will stop this from happening.
There are downsides of course. Once the expression is saved into a variable you can’t quickly see what’s going on and you’ll find yourself creating a number of text boxes on screen referencing the variables so you can see their contents.
I prefer another solution. All my expressions are stored in a data island (a data tables which isn’t linked to the rest of the structure) and I generate this using a simple spread sheet.
- I can add a lot more information such as the Label, Help Text and other developer notes and grouping which is only visible to me.
- I can search the spread sheet and make sweeping changes.
- I also create more expressions automatically during the load which links back to all the possible Point in Time flags I have in my As Of Calander.
- The data island also drives my customisable charts where a user can select what ever dimensions and expressions they like from a list and the chart will auto populate.
I will come back to these additional features in future post.
Love to hear your comments