In the previous recipe, you learned how to use the P()
function inside a Set Analysis expression. A P()
function returns a set of all possible values.
To take the concept a bit further, we will now see how to use the P()
function combined with the intersection operator *
to help us locate invoices where two or more products were sold together.
For the purpose of this recipe, we make use of product sales data by invoice, as defined in the following inline data load. Load the following script in the Qlik Sense Data load editor
:
Basket: LOAD * INLINE [ BasketInvoiceno, BasketProduct, BasketSales 101, Apple, 10000 101, Orange, 5000 101, Lemon, 6000 102, Apple, 30000 103, Orange, 4000 103, Strawberry, 4000 104, Lemon, 4000 106, Apple, 3000 106, Orange, 2000 107, Strawberry, 4000 ];