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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Concatenate strings for distinct values

Good morning, I have the following situation:


I have a code in column A and a column B with a field tha contains NOTES.
The field A may be repeated on multiple lines with different values of NOTES.

I need to have for each distinct value of the field A concatenation NOTES present in field B.


How can I do this?

Thanks

1 Solution

Accepted Solutions
jmmayoral3
Creator
Creator

You can use this expression:

=aggr(concat(distinct FieldB,''),FieldA)

View solution in original post

11 Replies
alexandros17
Partner - Champion III
Partner - Champion III

Fields A and B are in the same table?

If the answer is yes then:

Load

   ...

   A & B as myNewField

   ...

resident mytable;

let me know

MarcoWedel

Front end:

Chart with

Dimension: colA

Expression : concat(distinct colB)

Not applicable
Author

Hi guys, sorry but I don't understand.

The fields A and B are in the same table.

The table is the following:

NOTE00F:

LOAD

    NOKEY as [NUMERO CHIAVE],

    NONOTA

...

...

...

anbu1984
Master III
Master III

Can you post sample data and expected output

Not applicable
Author

FIELD A (CODE)FIELD B (NOTE)
LI11703020120117000000001XXXXXXXXXX
LI11703020120117000000001YYYYYYYYYY
LI11703020120314000000010AAAAAAAAAA
LI11703020120314000000010BBBBBBBBB
LI11703020120314000000010CCCCCCCC

I expect that the results is:

  

LI11703020120117000000001XXXXXXXXXXYYYYYYYYYY
LI11703020120314000000010AAAAAAAAAABBBBBBBBBCCCCCCCC
anbu1984
Master III
Master III

Load

FieldA,

Concat(FieldB,'')

From

Table

Group by FieldA

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

That's what Marco's code should produce. With the correct field names this is (in a straight table):

Dimension: [NUMERO CHIAVE]

Expression: Concat(DISTINCT NONOTA)

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
jmmayoral3
Creator
Creator

You can use this expression:

=aggr(concat(distinct FieldB,''),FieldA)

Not applicable
Author

Hello guys, The concatenation should follow the order of the field C.


   

FIELD A (NOKEY)FIELD B (NONOTA)     FIELD C ( RIGA)
LI11703020120117000000001XXX10
LI11703020120117000000001YYY20
LI11703020120314000000010AAA10
LI11703020120314000000010BBB20
LI11703020120314000000010CCC30


How do I give this indication to the function used? The function used is the following:
aggr (Concat (DISTINCT NONOTA, ''), NOKEY)


I would like to have the following string in output AAABBBCCC  while I get the following string AAACCCBBB.


Thanks.