Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to split one column data into two columns?

Hi,

I have column data as below

Status:

School
College
University
Department
AXN (D&R) - Delhi
AXN (D&R) - Mumbai
AXN (D&R) - Goa
AXN (D&R) - Bangalore
AXN (D&R) - Kochin
AXN (D&R) - Agra
AXN (D&R) - NewJersey
AXN (D&R) - Washington
AXN (D&R) - Chennai
AXN (D&R) - Pune

I want to show in chart Status split to two columns as below

Status:

School
College
University
Department

Status_AXN:

AXN (D&R) - Delhi
AXN (D&R) - Mumbai
AXN (D&R) - Goa
AXN (D&R) - Bangalore
AXN (D&R) - Kochin
AXN (D&R) - Agra
AXN (D&R) - NewJersey
AXN (D&R) - Washington
AXN (D&R) - Chennai
AXN (D&R) - Pune

Please can anyone suggest me how to do this in chart?

Thanks.

7 Replies
Miguel_Angel_Baeyens

Hello Amelia,

If that is really how the data will look like, then you can use a If() statement along with some text functions, for example:

Table:

LOAD

If(Left(Status, 3) = 'AXN', Status, null()) AS Status_AXN,

If(Left(Status, 3) <> 'AXN', Status, null()) AS Status

FROM Source;

If they are in the same table. Otherwise, a WHERE statement with similar functions.

Miguel

sunny_talwar

Do you want to split that column for a chart or that's how you want it to be within the data structure in QlikView?

Best,

S

Not applicable
Author

Thanks. I used in script. When I am two columns in table it is showing blanks under Status_AXN column. please can help me.

Not applicable
Author

I want to split the column for a chart

Anonymous
Not applicable
Author

Hi,

If you want to split data into two columns use miguels solution.

else if you want to group data so use below code to create flags in script and use in ui to visualise:

if(wildmatch(fieldname,'AXN*'),Status_AXN,Status) as Status;

Regards

Neetha

Not applicable
Author

Hi,

You can use same as Miguel,

just change the first if condition to If(wildmatch(Status,'*AXN*'), Status, null()) AS Status_AXN.

Hope you need this

regards,

Amay

Miguel_Angel_Baeyens

Yes, because you are creating two new columns in the script, and depending on the value, one or the other will be populated, but never both. That's what I understood from your original post.

Miguel