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

Concatenate two tables and keep duplicates

Hi guys,

 

I have two tables like:

Select Customer, 1 as Score resident table1;

concatenate

Select Customer, 1 as Score resident table2;

 

And sum(Score) for each customer returns 2. It seems duplicates are removed. I wonder if there is a way to keep them.

 

Thanks in advance!

1 Solution

Accepted Solutions
Vegar
MVP
MVP

The rows are not removed. They are still there, but Qlik never presents duplicate rows in a table. 

You can verify that all rows are kept by looking into the table in the data model overview. 9 or creating an table with customer as a dimension and count(customer) as a measure. You will see that you have two records per customer (if customer is present in both source tables. 

To display all customer rows separately You need some kind of row identifier to your final table.

Try this.

Select rowno() as RowId, Customer, 1 as Score resident table1;

concatenate

Select rowno() as RowId, Customer, 1 as Score resident table2;

View solution in original post

1 Reply
Vegar
MVP
MVP

The rows are not removed. They are still there, but Qlik never presents duplicate rows in a table. 

You can verify that all rows are kept by looking into the table in the data model overview. 9 or creating an table with customer as a dimension and count(customer) as a measure. You will see that you have two records per customer (if customer is present in both source tables. 

To display all customer rows separately You need some kind of row identifier to your final table.

Try this.

Select rowno() as RowId, Customer, 1 as Score resident table1;

concatenate

Select rowno() as RowId, Customer, 1 as Score resident table2;