It is best practice to design QlikView apps (or any BI application for that matter) in a way that presents the information in a clear and concise manner, so that users can spend their time and energy on analysis rather than wondering what it is they are actually looking at. Here is an example. I have a demo app that is designed with four text objects that serve as KPI’s. There are three possible scenarios that a user might be interested in when looking at Revenue by store type…by Same-Stores, New Stores and All Stores. Below you can see that without proper labeling a user might lose track of which store type they are analyzing. Not the end of the world to have to take a peek at the current selections box for a refresher, but as developers we should make every effort to design our apps so that users can get all of information they need in one spot.

By using nested if statements we can add a label that updates dynamically depending on user selection. Super simple feature, that will improve readability and the overall user experience. Below are the steps I took to accomplish this task.

1. My first instinct was to use the GetFieldSelection statement on the NEW_STORE field. Easy enough!

This statement worked fine if either New Store or Same-Stores were selected. However, if I was looking at All Stores combined, I ended up back at square one with no label. In fact, I ended up with a dash which wasn’t appealing and didn’t do much from a readability perspective. This lead me to explore nested if statements.

2. Create a new text object. With the General tab selected edit the text expression.

As you can see from the screen shot above this syntax is pretty straight forward. If New Stores is the selection then the label should output ‘New Stores’, if Same-Stores is selected, then output ‘Same-Store’ and finally if nothing is selected, then output ‘All Stores’. The beauty about Qlik is that there always seems to be multiple ways to accomplish the same task. This just happens to be the route I chose.

3. Below are images of the results based on the three possible store type scenarios.

Hope you found this useful!

Have more questions? We can help: