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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

split a column into new columns by character in qliksense

Hi all,

I have a csv file with a specific field like this:

TYPE

AT IT BA

IT BA

AT BA LB

RT LB


I want to create something like:

TYPE                  OPTION1              OPTION2               OPTION3

AT                    IT                   IT                    BA

IT                    BA

AT                    BA                   LB

RT                    LB

How i can do it?

Thanks!

1 Solution

Accepted Solutions
maxgro
MVP
MVP

with subfield function

X:

LOAD

subfield(TYPE, ' ', 1) as TYPE,

subfield(TYPE, ' ', 2) as OPTION1,

subfield(TYPE, ' ', 3) as OPTION2,

subfield(TYPE, ' ', 4) as OPTION3

FROM a.csv

(txt, codepage is 1252, embedded labels, delimiter is ';', msq);

subfield also works in chart

View solution in original post

5 Replies
sunny_talwar

I think when you load CSV you are able to specify the delimiter. Have you tried to specify <space> as your delimiter?

maxgro
MVP
MVP

try

LOAD @1 as TYPE, @2 as OPTION1, @3 as OPTION2, @4 as OPTION3

FROM yourfile.csv

(txt, codepage is 1252, no labels, delimiter is spaces, msq, header is 1 lines);

Not applicable
Author

Thanks! Some way to do without using the load statement?

Regards.

Not applicable
Author

If not, my file has a lot of columns, how i can adjust the load script to only split the desired column?

Regards.

maxgro
MVP
MVP

with subfield function

X:

LOAD

subfield(TYPE, ' ', 1) as TYPE,

subfield(TYPE, ' ', 2) as OPTION1,

subfield(TYPE, ' ', 3) as OPTION2,

subfield(TYPE, ' ', 4) as OPTION3

FROM a.csv

(txt, codepage is 1252, embedded labels, delimiter is ';', msq);

subfield also works in chart