Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Kunkulis
Creator
Creator

Merging multiple rows into one, but always show the rest of the values when one is chosen

Hello,

I have a data set with some information, this would be some dummy data:

Person Country
Kunkulis USA
Kunkulis Germany
Kunkulis Spain

 

From other question I have found, that by just using this formula:

=Aggr(Concat(DISTINCT Country, ', '), Person)

I will get the desired outcome:

Person Country
Kunkulis USA, Germany, Spain

 

But now if I would filter out, to show all the Person that have been to USA, I get this result:

Person Country
Kunkulis USA

 

Where I would like to see this (with additional dummies):

Person Country
Kunkulis USA, Germany, Spain
Bob USA
Rob Canada, Portugal, Sweden, USA

 

Any idea how this could be achieved? 

Labels (3)
1 Solution

Accepted Solutions
Kunkulis
Creator
Creator
Author

I think I got the result I was looking for.
I did it all in script.

One table as it was with all the data without any manipulation.
Second table just Loading Person and Concatenate Countries, resident initial table group by Person.

Then in the chart table I show the concatenated column, but in the listbox, I show the first tables country list 

View solution in original post

14 Replies
Marijn
Creator II
Creator II

You can also try to filter on *USA*, then QlikView will search for all values where USA is included.

Kunkulis
Creator
Creator
Author

I have a ListBox with all the countries, so selecting USA from it should produce the last table

Marijn
Creator II
Creator II

No, it shouldn't. When you search for USA, you search for an exact match. When your search for *USA*, it searches for USA and allows for characters before and after. Because you concatenated the Countries, you need to use the asterisks.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You don't need the Aggr() if you are using Person as a dimension in your chart.   I believe the expression you want is:

Concat({<Country=,Person=P()>}DISTINCT Country, ', ') 

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com

Kunkulis
Creator
Creator
Author

Thank you for the expression, but what is P()? 
I think due to this, the expression is failing for me.

Kunkulis
Creator
Creator
Author

That would be so, if this concatenation would happen in the Load, but I am performing it in a chart (straight table).

Thus the List box would still show all the countries separated

Kunkulis
Creator
Creator
Author

Hmm, I keep getting "Error in calculated dimensions" both trying 

Concat({<Country=,Person=P()>}DISTINCT Country, ', ')  

and

Concat({<Country=,Person=P(Person)>}DISTINCT Country, ', ')  

 

Does it change anything that I am trying to get this value as a dimension in a chart (straight table) ? 

GeigerS
Contributor
Contributor

Select the range of cells where you want to merge rows.Go to the Ablebits Data tab > Merge group, click the Merge Cells arrow, and then click Merge Rows into One.

ACAeronet Sign In