Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How can I turn one field of data into multiple fields ?

Hi

One field of my data looks like this.

Account Number 98121012 Account Name XXX Branch Code 63205

All the other fields have just one entry.

I would like to turn this field into 3 different Fields.

Thanks

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Another possibility.

TextBetween(field, 'Account Number', ' ')

-Rob

View solution in original post

9 Replies
NareshGuntur
Partner - Specialist
Partner - Specialist

If the length of the values is constant, you can try left(), right(), subfield() etc.

Cheers,

Naresh

Colin-Albert

Use subfield()

subfield(data, ' ', 3) as [Account Number],

subfield(data, ' ', 6) as [Account Name],

subfield(data, ' ', 9) as [Branch Code],

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Another possibility.

TextBetween(field, 'Account Number', ' ')

-Rob

Anonymous
Not applicable
Author

Hello,

also you can use this expressions if you want to split them by the name:

load SubField(SubField(fieldname, 'Account Name', 1 ), 'Account Number', 2 ) as field1,

SubField(SubField(fieldname, 'Branch Code', 1 ), 'Account Name', 2 ) as field2,

SubField(fieldname, 'Branch Code', 2 )as field3

resident...

buzzy996
Master II
Master II

subfiled() is best suggestion i believe.

Mark_Little
Luminary
Luminary

Hi,

This is the way i would normally approach the issues, But i will be giving Rob's approach ago next time.

Mark

HirisH_V7
Master
Master

Hi ,

Check this way according to your field ,

1)

K:

LOAD * INLINE [

Date

20100101

20100102

];

K:

Load

mid(Date,1,4) as YEAR,

Mid(Date,5,6) as Month,

mid(Date,7,8) as Day

Resident K;


2)

K:

LOAD * INLINE [

Date

Jan-2015-P1

Jan-2015-P2

];


K1:

Load

SubField(Date,'-',1) As Month,

SubField(Date,'-',2) As Year,

SubField(Date,'-',3) As Type,

'01-' & If(SubField(Date,'-',1)='Jan','01' , If(SubField(Date,'-',1)='Feb','02' ,If(SubField(Date,'-',1)='Mar','03')))&'-' & SubField(Date,'-',2) As Date


Resident K;

DROP Tables K;


3)

K:

LOAD * INLINE [

Date

Jan-2015-P1

Jan-2015-P2

Jan-2015-A1

];


K1:

Load

TextBetween(Date,'Jan-','-') as Year

Resident K;

DROP Tables K;

Hope this helps,

cheers,

Hirish

HirisH
“Aspire to Inspire before we Expire!”
Not applicable
Author

Hi Rob

The  function - TextBetween(field, 'Account Number', ' ')did worked


Thanks

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Please go ahead and mark something correct to close the thread.

-Rob