How To Use Variables In Qlik Sense
Are y'all gasping right now after reading the championship? Shaking your head in disagreement? Well, let me explain…..
At Qonnections this year I gave a talk on various do's and don'ts when creating large enterprise sized Qlik Sense deployments. 1 common thread (although non referenced by myself in any big way) was the difference between QlikView and Qlik Sense when it comes to development. I spoke most this recently in my blog post "Set up to be searched". The idea being that we, as developers, need to focus more on the data model than nosotros did when developing in QlikView because we now expect the user to search for more than information and insights.
Nosotros besides expect them to create their own visualisations on the fly and for that they need an hands understandable information model and with that in mind we demand to call up about how we supply our users with Dimensions, Measures and Visualisations in the Master Items.
In QlikView it was fairly standard to place all expressions into variables before releasing the dashboard into production. There are a number of reasons for this:
- Metric Governance – Yous only take to edit the variable once to know all instances of that measure will be consistent as they all reference the same variable
- Hierarchical Metric Governance – For measures such as Margin, instead of writing the expression in full you reference the lower level variables for Sales and Cost. As before you only have to update one to know all instances of that measure out will be consequent.
- Operation – Little known one this. If you take two expressions "=sum(Sales)" & ="sum( Sales )" (find the redundant spaces in the second expression!) the engine parses them every bit ii separate expressions and therefore takes twice the processing ability to calculate. If they were written identically so they would exist calculated once regardless of how many times they are used.
With all these benefits why on globe would we stop using expressions?
Its because of the user experience, if we're using variables when the user wishes to edit a principal measure they don't get a great starting place to work from…
The above example is not very helpful and the user is likely to experience frustrated. I believe reading something and understanding the context is far simpler than creating something from scratch. If you expect at the following instance try to see it with fresh eyes as if you're a Qlik cease user:
Here when the user edits the master measure they immediately get insight into what calculation is being performed. You could take this a stride farther by embedding help within the expression itself such as with the following more detailed instance.
Now the user can encounter exactly whats going on even with the addition of Fix Analysis. Nigh users should be able to edit the measure out or perhaps take it a step further using this and other measures equally a starting betoken for something new, cherry picking the information from each and creating a new calculation to cocky serve a discovery from the data.
How am I going to manage all this extra work !
From a developer point of view how are we going to manage this? Challenges are:
- Fast population and fifty-fifty more importantly automatically updating the Master Items with calculation changes
- Reduce duplication past allowing measures to reference themselves
Firstly, As about developers do with variables nosotros tin can withal handle creation and updating of the Master Items with an external file such as a workbook. A quick search of "Master" in Qlik Branch Garden brings upwardly a number of extensions that automate the procedure (shown below). This is done by leveraging the ability of Qliks amazing APIs!
I've also heard whispers in the community that rather than relying on a third party extension to speedup the process Qlik are going to make that part of the cadre product …. nosotros shall wait and see !
From a risk bespeak of view in regards to extensions, if the i y'all choose stops working y'all can simply switch back to a manual procedure. Then different a chart extension availability and performance your risk is pretty much none existent.
The last thing yous need to consider is Hierarchical Metric Governance. During the talk I was asked a question effectually Primary Items referencing each other. This tin can't be washed currently although I believe its in the pipeline. Regardless I don't call back this is required or causes an event as I had to resolved a like problem many years ago on QlikView!!!
The challenge was to automatically create time iterations of the aforementioned metric such every bit Yesterday, Final Year, Qtr to Date, etc. I created a script in QlikView (blogged nigh here) which did this and which even took into account measures that are dependant on each other and then its totally possible to automate the process and its something I'1000 going to practise specifically for Qlik Sense in the virtually future.
With these two points covered I don't come across any reason why you should notwithstanding be using variables for expressions in Qlik Sense.
Nonetheless non convinced?
Well I'm really having to work to win you over today! Okay, so let me tell you virtually my hatred of variables (Vloged about before). The result is how they persist unless y'all physically delete them, once they have a value afterwards the script has stopped running you're stuck with them.
In QlikView one of may standard pre-release tests was to delete all the variables, run the script (which should recreate all the required variables) and test all is okay. Ofttimes I've found problems where an old variables is removed from the script or the control sheet only not deleted from the app and it becomes a bug in the calculations or functionality.
Without leveraging the APIs in QlikSense y'all have to manually delete all the variables (which can take an historic period so near people don't bother). For this very reason I would only employ variables where absolutely necessary keeping the list to an absolute minimum.
Have care, Rich
PS – Its a leaning curve, my showtime postal service on the subject field (ca. 2015) Storing Expressions In Variables did explore the benefits of using Variables although my preferred pick fifty-fifty back so was always a data isle 😉
How To Use Variables In Qlik Sense,
Source: https://qlikcentral.com/2019/05/22/stop-storing-your-qlik-sense-expressions-in-variables/
Posted by: folsehishey.blogspot.com
0 Response to "How To Use Variables In Qlik Sense"
Post a Comment