Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

rambocoder99
New Contributor

How to merge two rows into a single row

I wanted to merge content from two rows into a single row. Here is an example, if the input is the below table.

Header 1Header 2Header 3Header 4
I2I1I3I4
I6I7I8I9

The output should be as shown below

Header 1Header 2Header 3Header 4
I2 I6I1 I7I3 I8I4 I9

Kindly let me know how I can proceed with this.

3 Replies
vishsaggi
Esteemed Contributor III

Re: How to merge two rows into a single row

Use Concat() function to merge the data. Like.

LOAD Concat(Distinct Header1, ' ') AS Header1,

           Concat(Distinct Header2, ' ') AS Header2,

           Concat(Distinct Header3, ' ') AS Header3,

           Concat(Distinct Header4, ' ') AS Header4

FROM yoursourcetable;

Re: How to merge two rows into a single row

Re: How to merge two rows into a single row

Hi,

another solution might be:

QlikCommunity_Thread_278329_Pic1.JPG

table1:

LOAD Previous(Header1)&' '&Header1 as Header1,

    Previous(Header2)&' '&Header2 as Header2,

    Previous(Header3)&' '&Header3 as Header3,

    Previous(Header4)&' '&Header4 as Header4

INLINE [

    Header1, Header2, Header3, Header4

    I1, I2, I3, I4

    I5, I6, I7, I8

    I9, I10, I11, I12

    I13, I14, I15, I16

    I17, I18, I19, I20

    I21, I22, I23, I24

    I25, I26, I27, I28

    I29, I30, I31, I32

]

Where Even(RecNo());

hope this helps

regards

Marco