Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
JacoAucamp
Contributor II
Contributor II

Data manipulation

If anyone can help I would appreciate it.

I have data that is one different rows of the table, but the have a common cell in the data.

And I would like to shows case it next to eachother instead of having different rows.

Example:

OUTPUT:

Alternate info Info Info Info
Test Random data 1 Random data 2 Random data 3
Input  
Alternate info Info
Test Random data 1
Test Random data 2

Test

Random data 3
Labels (2)
1 Solution

Accepted Solutions
edwin
Master II
Master II

there are at least two general answers to this. 
the first one is involved and requires more analysis as you may want a scalable solution - what are you trying to accomplish?  how large is your data?  do you need an optimized UI? etc..
the 2nd is straight forward, a direct answer to a specific question.
the reason i brought that up is that sometimes the straight forward asnwer is not always the best answer as it drives other problems down the road.

having said that, my simple answer is this:
1. concatenate the info column grouped by alternate column:

 

NoConcatenate
NewTable:
load [Alternate info], concat(info,'|') as infoS
resident originalTable
group by [Alternate info];

 

this will result in the following table:

test info1|info2|info3
test2 info4|info5|info6|info7


2: in your table you have no choice but to create the maximum number of columns needed to cover all your concatenated field + the 1st field.  if the number of INFO fields is fixed then it is simpler, but if the number of fields is not consistent then you will have to add a condition to show or hide each field depending on the length of the concatenated field.
for the fist concatenated field:

 

subfield(InfoS,'|')

 

here is a sample you can see the expressions:

edwin_0-1682515028960.png

 

View solution in original post

1 Reply
edwin
Master II
Master II

there are at least two general answers to this. 
the first one is involved and requires more analysis as you may want a scalable solution - what are you trying to accomplish?  how large is your data?  do you need an optimized UI? etc..
the 2nd is straight forward, a direct answer to a specific question.
the reason i brought that up is that sometimes the straight forward asnwer is not always the best answer as it drives other problems down the road.

having said that, my simple answer is this:
1. concatenate the info column grouped by alternate column:

 

NoConcatenate
NewTable:
load [Alternate info], concat(info,'|') as infoS
resident originalTable
group by [Alternate info];

 

this will result in the following table:

test info1|info2|info3
test2 info4|info5|info6|info7


2: in your table you have no choice but to create the maximum number of columns needed to cover all your concatenated field + the 1st field.  if the number of INFO fields is fixed then it is simpler, but if the number of fields is not consistent then you will have to add a condition to show or hide each field depending on the length of the concatenated field.
for the fist concatenated field:

 

subfield(InfoS,'|')

 

here is a sample you can see the expressions:

edwin_0-1682515028960.png