Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Concatenate the values of multiple records for one field

Is it possible to concatenate rows in one field in this way:

Let's say we have this table:

Client Product

1 A

1 B

2 B

2 C

2 D

I would like to generate the following table:

Client Products

1 A - B

2 B - C - D

The amount of products per client varies.

Thanks for your help

Johan

1 Solution

Accepted Solutions
maneshkhottcpl
Partner - Creator III
Partner - Creator III

Hi,

U can also use the previous tricks to concatenate the row values





Client Product

1 A

1 B

2 B

2 C

2 D

load Client,concat(Product,'-') as NewProduct resident Tablename group by Client;

Please refer attached application.

View solution in original post

4 Replies
Miguel_Angel_Baeyens

Hello Johan,

I'm not very used to do aggregations in the script, but this seems a good moment to do something like this:

Table1:LOAD Client, ProductFROM Source; Table2:LOAD Client, If(Previous(Client) = Client, RangeSum(Peek('ProductsAcum'), -1 * Products), 1) AS ProductsAcumRESIDENT Table1ORDER BY Client; // Table previously loaded with raw data


Hope that helps

maneshkhottcpl
Partner - Creator III
Partner - Creator III

Hi,

U can also use the previous tricks to concatenate the row values





Client Product

1 A

1 B

2 B

2 C

2 D

load Client,concat(Product,'-') as NewProduct resident Tablename group by Client;

Please refer attached application.

Anonymous
Not applicable
Author

Johan,

It can be done by using concat() function:
concat(distinct Products, ' - ')
You can use it either in script or on front end, whatever you prefer.

Not applicable
Author

Thanks a lot guys!

I like the simplicity of the concat() and group by combination!