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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
vamsi_krishna
Contributor II
Contributor II

Convert string to Date formate

Hi All,

I have a string format with April_2016-2017

need to convert to different formats

i,e 2016-2017

April

2016

2017

Thank you

Labels (1)
1 Solution

Accepted Solutions
antoniotiman
Master III
Master III

LOAD DISTINCT SubField(SubField(SubField(Field,'_'),'-')&'|'&SubField(Field,'_',-1),'|') as Field
INLINE [
Field
April_2016-2017
]

View solution in original post

7 Replies
sunny_talwar
MVP
MVP

What is the output you want to get from April_2016-2017?

vamsi_krishna
Contributor II
Contributor II
Author

i need 3 different formats

2016-2017

April

2016

Chanty4u
MVP
MVP

did u try this?

dat:

LOAD * INLINE [

    F1

    April_2016-2017

];

LOAD *,

subfield(F1, '_' ,1) as 1,

subfield(F1, '_' ,2) as 2,

SubField(F1,'-',3) as 3

Resident dat;

vamsi_krishna
Contributor II
Contributor II
Author

no its not working

antoniotiman
Master III
Master III

May be

LOAD SubField(SubField(Field,'_'),'-') as Field
INLINE [
Field
April_2016-2017
]
;

Anonymous
Not applicable

Perhaps this is what you seek:

data:

LOAD * INLINE [

  field

  April_2016-2017

];

test:

LOAD

  *,

  subfield(field, '_' ,2)  as YearRange,

  subfield(field, '_' ,1)  as Month,

  subfield(subfield(field, '_' ,2), '-', 1)  as FirstYear

Resident data;

antoniotiman
Master III
Master III

LOAD DISTINCT SubField(SubField(SubField(Field,'_'),'-')&'|'&SubField(Field,'_',-1),'|') as Field
INLINE [
Field
April_2016-2017
]