Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

convert many columns to be one column

Dears,

Appreciate your help.

I have a file with this data structure

AccNo     Name       Invoice#1   Invoice#2    Invocie#3

1              john         112345      112346  

2            michael      112395      112398      112399

I want to import it and be like this (convert many columns to be one column)

AccNo     Name     Invoice#

1              john        112345

1              john        112346

2            michael     112395

2            michael     112398

2            michael     112399

7 Replies
alexandros17
Partner - Champion III
Partner - Champion III

here it is:

TAB:

LOAD * Inline [

AccNo ,    Name,       Invoice#1,   Invoice#2 ,   Invoice#3

1    ,          john   ,      112345,      112346, 

2     ,       michael   ,   112395   ,   112398   ,   112399

];

FinalTab:

NoConcatenate

LOAD AccNo ,    Name,       Invoice#1 as invoice Resident TAB;

Concatenate

LOAD AccNo ,    Name,  Invoice#2 as invoice Resident TAB;

Concatenate

LOAD AccNo ,    Name,  Invoice#3 as invoice Resident TAB;

DROP Table TAB;

Anonymous
Not applicable
Author

PFA.

Hope it helps you

Regards

Nitin

MK_QSL
MVP
MVP

CrossTable(Invoice, InvoiceNumber,2)

Load * Inline

[

AccNo, Name,       Invoice#1,   Invoice#2,  Invoice#3

1,      john,       112345,      112346,

2,      michael,    112395,      112398,     112399

];

Drop Field Invoice;

rajat2392
Partner - Creator III
Partner - Creator III

you can simply use crosstable...

when you load the data, click next, Enable Transformation Step, then next and then cross table..set first two fields (AccNo., Name) as qualifiers and Give attribute a name as "Invoice"

Not applicable
Author

use crosstable prefix.

crosstable(invoice#, invoice, 2)

Load * Inline

[

AccNo, Name,       Invoice#1,   Invoice#2,  Invoice#3

1,      john,       112345,      112346,

2,      michael,    112395,      112398,     112399

];

it will combine all the invoice fields into one field invoice

arjunkrishnan
Partner - Creator II
Partner - Creator II

D1:

LOAD AccNo,

     [Name      ],

     Invoice#1,

     Invoice#2,

     Invoice#3

FROM

inVO.xls

(biff, embedded labels, table is [Sheet1$]);

NoConcatenate

T1:

LOAD AccNo,

     [Name      ],

     Invoice#1 AS Invoice#

     Resident D1;

Concatenate   

T2:

LOAD AccNo,

     [Name      ],

     Invoice#2 AS Invoice#

     Resident D1;

     Concatenate

T3:

LOAD AccNo,

     [Name      ],

     Invoice#3 AS Invoice#

     Resident D1;

    

RESULT LIKE THAT

hic
Former Employee
Former Employee

Use the Crosstable prefix. Read more here: http://community.qlik.com/blogs/qlikviewdesignblog/2014/03/24/crosstable

HIC