Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Adding Rows Based On Partial Match

Need to bring in some additional rows into the Fact table from another source. Some of the rows are common but I need to add only those that are not present in FACT currently. But rows should be entered based on 2 out 3 common fields. For example, I need to match SalesPersonID and ProdName only, even though Category also happens to be a common field.

Appreciate any thoughts.

FACT:

SalesPersonIDProdNameCategoryRegion$Sales
adamcarcat1Asia15000
johntruckcat3Americas40000
johncarcat1Europe22000
johnsuvcat2Americas35000
mikesuvcat2Americas33000
mikecarcat1Europe23000

2nd Source:

SalesPersonIDProdNameCategory
adamcarcat1
adamsuvcat2
johnsuvcat2
mikecarcat1
miketruckcat3

Desired Resulting Table:

SalesPersonIDProdNameCategoryRegion$Sales
adamcarcat1Asia15000
adamsuvcat2
johntruckcat3Americas40000
johncarcat1Europe22000
johnsuvcat2Americas35000
mikesuvcat2Americas33000
mikecarcat1Europe23000
miketruckcat3
2 Replies
Frank_Hartmann
Master II
Master II

Just join the two tables:

Fact:

Load * Inline [

SalesPersonID,    ProdName,    Category,    Region,    $Sales

adam,    car,    cat1,    Asia,    15000

john,    truck,    cat3,    Americas,    40000

john,    car,    cat1,    Europe,    22000

john,    suv,    cat2,    Americas,    35000

mike,    suv,    cat2,    Americas,    33000

mike,    car,    cat1,    Europe,    23000];

join

Source:

Load * Inline [

SalesPersonID,    ProdName,    Category

adam,    car,    cat1

adam,    suv,    cat2

john,    suv,    cat2

mike,    car,    cat1

mike,    truck,    cat3];

Hope it helps!

Anonymous
Not applicable
Author

Understand, but I need joining based on two fields not three. From my original post:

"But rows should be entered based on 2 out 3 common fields. For example, I need to match SalesPersonID and ProdName only, even though Category also happens to be a common field."