Qlik Sense Basket Analysis

    Who here LOVES alternate states in QlikView?


    A brief description (and the reason I wanted to explore the subject) is that Alternate States allow you to segment one or many dimensions in your data in to their own "state". I can easily compare something like sales of product A to sales of product B.


    Well alternate states does not yet exist in Qlik Sense and basket analysis is hugely important for industries like Retail so they can analyze exactly what I described (sales by product, segment or region). Now QlikView did not always have Alternate States either so how did we accomplish the same type of analysis?


    Here is what I came up with (I'm sure there is more than one way to accomplish this):


    1. I created a "data island" so that I can break the connection between Basket A and B. A user can then select a value from Basket A and a different value in Basket B while still utilizing Green-White-Gray.

    Sense Basket Analysis Model.jpg


    2. Now that the user can select from Basket A and B we want to display them next to each other so I created a bar chart for side by side analysis. For the Basket A (left) side I just created a measurement based on my original data model. For the Basket B (right) side I used Set Analysis to apply the data island selections to my calculation.


    Sense Basket Analysis.jpg


    Basket B set analysis

    I did identify one quirk when writing the set expression where not selecting any values could not calculate so I added some logic to handle the "NULL" selection as select ALL or "*".


    Sum({<CategoryName={'$(=if(IsNull(CategoryName2)=0,CategoryName2,'*'))'},ProductName={'$(=if(IsNull(Product2)=0,Product2,'*'))'}>} Sales)