Thursday, December 6, 2012

Alternative states in Qlikview

QV11 introduced this new feature - Alternative states. In QV older versions once a selection is made on a field  same state will be reflected through out the UI.

For example when Countryname USA is selected whole report will highlight information about USA.

Take a example text object showing sum of sales in a country:
  • On selecting Countryname as USA text box will show sum of sales in USA.
  • On selecting Countyname as UK text box will show sum of sales in UK.
  • On selecting both countries it shows sum of sales in both countries.
If we want to compare these two country results we can't do it. ( we can achieve it to some extent by manually having condition in 2 text boxs as Countryname=USA, and UK but this is not dynamic ).

With alternative states we can implement this by creating  different states for different sum's used for comparison. In this case we need to create two states because we need to compare two different sums.
  • To start with , first we should create states in Document Properties -> Alternative states.

Once states has created they will be available throughout the report and can be applied to any sheet object as below.
Select a field in a list box object with state1 as below and 1 more list box with state2.

All sheet objects with a state will have synch among them.
Create  2 text objects with expression sum(Sales) and select State1 and State2.

Below is screen shot of objects that we created.
Objects pointed with arrow are maintaining State1.Including current selection object.
Two text boxes shows sales of 2 different countries.

With this now we can compare sum of sales of any country with any other country.

We can see that Product Name field values are filtered automatically based on selection made in that state( CountyName).
We can also have fields without any states applied(right most). they will be isolated with these objects created for comparison . and they can be used for navigating rest of the report which doesn't have any relation with Alternative states we created.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.