Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Deriving a third Field from 2 tables

Hell Everyone,

I have 2 tables Product and Sales. Each Product ID in Product Table is attached to Multiple SALES ID  in Sales table.

PRODUCT TABLE:

PRODUCT ID
1
2
3
4
5
1
2
3
5
6
7
85
4
68

SALES TABLE:

Sales.PNG

I want to create a field in my Product table known as "Has3rdParty" which would have following values corresponding to each Product ID:

1) All 3rd Party: if in the Sales Table the Managed By field has value "Thrid Party" for all the Product ID. example ID = 2

2) Some3rdPArty: id some of the values are Third Party and not all. example ID= 1

3) No 3rdParty: example Id=5

Thanks in advance for any help on this. I'd really appreciate your response.

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Here's one approach:

LEFT JOIN (ProductTable)

LOAD

          ProductId,

          if(ManageList='Third Party', 'All 3rd Party'

          ,if(wildmatch(ManageList, '*Third Party*'), 'Some3rdParty'

          ,'No 3rdParty'

          )) as ManageType

;

LOAD

          ProductId,

          concat(DISTINCT ManagedBy, ',') as ManageList

RESIDENT SalesTable

Group BY ProductId

;

Example attached.

-Rob

http://robwunderlich.com

http://qlikviewcomponents.org

View solution in original post

2 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Here's one approach:

LEFT JOIN (ProductTable)

LOAD

          ProductId,

          if(ManageList='Third Party', 'All 3rd Party'

          ,if(wildmatch(ManageList, '*Third Party*'), 'Some3rdParty'

          ,'No 3rdParty'

          )) as ManageType

;

LOAD

          ProductId,

          concat(DISTINCT ManagedBy, ',') as ManageList

RESIDENT SalesTable

Group BY ProductId

;

Example attached.

-Rob

http://robwunderlich.com

http://qlikviewcomponents.org

Not applicable
Author

Thank you Rob, it worked. I really appreciate your response.