Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
pradnyan
Not applicable

HOW TO CONCAT FIELDS?

Hi,

I am new to Qlik Sense and need help on below issue urgently.

I have a Table as follows:

I have field names Product Name in which there are different Products :

Product Name

S1

S2

S3

S4

S5

S6

CustidProduct Name
1S1
1S2
2S3
2S1

and i am looking for output like:-

CustidProducts bought
Products not bought
1S1,S2S3,S4,S5,S6
2S3,S1S2,S4,S5,S6

Actually in the Output of Products not bought I want all product name which are not bought by the Customer and they must be comma seperated.

Tags (1)
1 Solution

Accepted Solutions
shraddha_g
Not applicable

Re: HOW TO CONCAT FIELDS?

For Products Brought

Concat(Distinct [Product Name],',')

5 Replies
shraddha_g
Not applicable

Re: HOW TO CONCAT FIELDS?

For Products Brought

Concat(Distinct [Product Name],',')

Vegar
Not applicable

Re: HOW TO CONCAT FIELDS?

Take a look at the concat() function.

https://help.qlik.com/en-US/qlikview/12.0/Subsystems/Client/Content/Scripting/StringAggregationFunct...

Please ekskuse my Norglish and Swenglish typos.
pradnyan
Not applicable

Re: HOW TO CONCAT FIELDS?

Thnx for reply.. but it want solution for products which are not bought..

pradnyan
Not applicable

Re: HOW TO CONCAT FIELDS?

hi,

can you please help me for syntax..

Not applicable

Re: HOW TO CONCAT FIELDS?

hi pradya,

Try this:

Table:

LOAD *,

  1 as Flag;

LOAD * INLINE [

    CustomID, Items

    1, S1

    1, S2

    2, S3

    2, S1

    3, S2

    3, S3

];

Temp:

LOAD DISTINCT Items as AllItems

Resident Table;

Left Join(Temp)

LOAD Distinct CustomID

Resident Table;

Join (Table)

LOAD CustomID,

  AllItems as Items

Resident Temp;

FinalTable:

LOAD CustomID,

  Concat(If(Flag = 1, Items), ', ') as [Items Bought],

  Concat(If(Flag <> 1, Items), ', ') as [Items Not Bought]

Resident Table

Group By CustomID;

DROP Tables Temp, Table;