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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Shivam22
Contributor III
Contributor III

Qlik concat fields based on measure values

Hello All,

 

I have a table like below

ID    Date        Country     Value

1   2/3/2025    Argentina     0

1  2/3/2025     Mexico        100

 

when i use function concat(Country, ',')  and used as expression in above table i get below result

ID    Date        Country               Value

1   2/3/2025    Argentina,Mexcio     100

 

but i want the result like below where Mexioc should come first then Argentina since Mexico has value

ID    Date        Country                Value

1   2/3/2025    Mexcio,Argentina    100

 

Can anyone please help!

 

Thanks in Advance!

 

 

 

Labels (2)
1 Solution

Accepted Solutions
Chanty4u
MVP
MVP

Try this 

Concat(DISTINCT Country, ', ', -Value)

 

View solution in original post

5 Replies
robert_mika
MVP
MVP

There is another parameter you can use.

Look at Qlik help or here

https://community.qlik.com/t5/QlikView-App-Dev/Concat-string-by-order/td-p/893090

Chanty4u
MVP
MVP

Try this 

Concat(DISTINCT Country, ', ', -Value)

 

Shivam22
Contributor III
Contributor III
Author

Thanks @Chanty4u it works, 

When i have data like below
ID    Date        Country     Value

1   2/3/2025    Argentina     0

1  2/3/2025     Mexico        100

1  2/3/2025     Mexico        200

 

Gives me result

1  2/3/2025     Mexico,Mexico,Argentina        300

 

How can we get Mexico value only once?

1  2/3/2025     Mexico,Argentina        300

 

Thanks Alot

 

 

 

 

robert_mika
MVP
MVP

Maybe

Concat(DISTINCT Country, ', ', aggr((-Value), Country))

Shivam22
Contributor III
Contributor III
Author

Thanks @robert_mika 

For some reason the result is like below, Mexio is repeating  3 times

1  2/3/2025     Mexico,Mexico,Mexico,Argentina        300

Thank You!