With the shipment of QlikView 11 comes an incredibly cool feature: Conditional Enablement of Dimensions and Expressions. That is “fancy speak” for being able to change the columns in your chart based on any number of conditions.
QlikView Custom Reporting
This can have various purposes but the one I am using most often is the ability for your users to create their own Ad Hoc reports or Custom Reports. Using QlikView conditional expressions and dimension columns we can allow the user to select which columns they want to see in a table, thereby creating their own report. Let’s create an example to illustrate some tips I have learned.
You can find the example qvw here.
The first thing you will want is an inline table of the dimensions and expressions you will want the user to be able to select. I would recommend two columns, one for the descriptor and one to uniquely identify it by a single letter.
LOAD * INLINE[
Order Num, A
LOAD * INLINE[
Order Num, A
This table will not be associated to any other tables in your model. Depending on your need, you might create a table for your selectable dimensions and one for your selectable expressions.
Now that you have your selectable dimensions and/or expressions to choose from, you can go to the layout and create list boxes to show the options. I like to add the Clear and Select All menu icons to the captions for these lists. It might also help to add a help message or label the caption with “Pick the columns to display” or similar.
Now create the object that the user will be customizing. You can put conditional dimensions or expressions in any kind of object. Here, we will create a straight table. Add all the fields referenced by your dimension list. And add the calculated expressions that relate to any selectable expressions you created.
This is where the magic happens. In the dimension properties, check the option for “Enable Conditional” and enter the following code:
=SubStringCount(Concat(_Dim_ID, ‘|’), ‘A’)
You will want to add similar code to each dimension, changing the letter to correspond with what you used in your inline table. Then do the same thing for your expressions if desired.
The last thing to do is add a Calculation Condition to the general tab of the object so that the object only displays when at least one dimension and expression is selected:
I then add a message to Error Messages for “Calculation condition unfulfilled” that reads similar to “Please choose at least one dimension and one expression to display… “
Click OK and now you should have a working Ad Hoc report. Choose various dimensions and expressions and the chart should change according to your selections.
Some tips and warnings:
- I use a letter ID because there is less potential of accidently displaying more dimensions than intended with the SubStringCount function. For example, 1 will return a result for 1, 10, 11, 21, 100 etc. Using the actual dimension names can also be troublesome especially with columns like “Invoice” and “Invoice Line” for example.
- As of this writing (QV11 Initial Release), there is a bug in interactive sort for columns. I haven’t been able to isolate the behavior.
- Also, I have found that when using a pivot table, there is sometimes an issue when attempting to pivot a dimension horizontally.
Even with the pivot and sortation issue, I am finding that my clients are very happy with this new flexibility. It was something not easily accomplished in prior versions.
I hope you have success with this and are able to expand the uses further.