Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
Not applicable

How to select the market baskets with both products

I need to make a sample with only the market baskets that have necessarily both products X and Y. I don't want the baskets tha have only X or Y. See the attachment, in green are the baskets I want.

I'm working with csv files in Qlik Sense.

Tags (1)
4 Replies

Re: How to select the market baskets with both products

Do you want to flag them or remove them in the script? By flagging you would be able to call just those rows which meet your criteria, while still having them in the application to use elsewhere. By removing, you would just have the desired rows and rest all will be removed, assuming they are not needed in the application anywhere.

Not applicable

Re: How to select the market baskets with both products

Sunny, thank you for helping. I'd like a way that is easier for the end user. But if I use flag, how should be the script to exactly meet the criteria? I'm using csv files.

Re: How to select the market baskets with both products

Here is how the flags will look like:

Capture.PNG

Script:

Table:

LOAD * Inline [

Cesta, Produto, Quantidade

1, y, 3

1, x, 5

1, z, 2

2, x, 3

2, j, 7

3, y, 1

4, x, 2

5, z, 1

6, x, 10

6, y, 5

];

Left Join(Table)

LOAD Cesta,

  If(Sum(If(Match(Produto, 'y', 'x'), 1, 0)) = 2, 1, 0) as Flag

Resident Table

Group By Cesta;

Not applicable

Re: How to select the market baskets with both products

Sunny, thank you! That Helped a lot!

Community Browser