Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
fdemolin
Contributor II
Contributor II

Help: Count values from a related table.

Hi Guys, I'm having trouble with a calculation.

Let's say that I have 2 tables. The first one represents all my sales, with the order id, product id and a primary key wich combines these 2 fields like this:

  

Order/Product.IDOrderProduct.ID
1010/000110100001
1010/000310100003
1010/000410100004
1020/000110200001
1020/000310200003
1030/000110300001
1030/000210300002
1030/000410300004
1040/000110400001
1040/000210400002

The second table, represents the customers' claims, with the exact same fields, but with the defect.id too, like this:

    

Order/Product.IDOrderProduct.IDDefect.Id
1010/000110100001A
1010/000310100003B
1030/000210300002B
1040/000110400001

A

They are linked through Order/Product.ID

Now here is my problem: When I filter for a certain Defect.Id in Qlik Sense I would like to see a KPI which shows how many times the products with this defect were bought.

For example:

If I filter for Defect.Id "A" it should return the value 4 (Just Product 0001 has this defect and it was sold 4 times)

If I filter for Defect.Id "B" it should return the value 4 too ( Product 0002, sold 2 times and Product 0003, sold 2 times)

Thanks in advance!

0 Replies