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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
vinod2086
Creator II
Creator II

How to split units in one field

Hi Friends,

i need one help i have one field like

field with unit
OTHERS
33.512
11 Mbps
2 kbps
40.20 gbps
12 gb

but here i want to split field with unit into[ field value] and [field  unit].

Thanks in Advance.

14 Replies
sushil353
Master II
Master II

hi,

It is better if you describe your issue in detail with sample desired output.

vinod2086
Creator II
Creator II
Author

Hi Sushil,

i want to split single field into two fields like

[field with unit] into 1) [field value] like-- others 11 33.512

                             2)[field unit]] like mbps kbps gb

am expecting output like that.

sushil353
Master II
Master II

Hi,

You can simply use KeepChar() and purgechar function..

purgechar('absad123',123) returns absad

keepchar('asdf123',123) returns 123

HTH

sushil

Anonymous
Not applicable

Hi,

Try with this code:

LOAD fieldwithunit,

  KeepChar(fieldwithunit, '1234567890.') as fieldvalue,

  Trim(PurgeChar(fieldwithunit, '1234567890.')) as fieldunit

FROM yoursource;

Marc.

sujeetsingh
Master III
Master III

Use subfield() function

sujeetsingh
Master III
Master III

As

SubField(FieldName, ' ') will give you only number entries.

Not applicable

Hi,

Try these two in your load script

SubField(YourField,' ',1) as [Field Value],

SubField(YourField,' ',2) as [Field Unit]

Regards,

Ravikumar

IAMDV
Master II
Master II

If the delimiter is always a space (" ") then you can use the Subfield() function, if not then please provide full data to get more precise answer.

Thanks,

DV

www.QlikShare.com

MayilVahanan

HI

Try like this

Load *, SubField(FieldWithUnit,' ', 2) as Value,SubField(FieldWithUnit,' ', 1)  as Unit Inline

[
FieldWithUnit
OTHERS
33.512
11 Mbps
2 kbps
40.20 gbps
12 gb
]
;

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.