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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
raZor
Contributor III
Contributor III

get month from string

Hi Guys,

 

i have a value of a field like this R191024_000008

where i want to consider only first 5 characters R1910 where 'R' stands for Request, 19 is Year(2019) and 10 is Month(Oct.). can any one help me to get them in qlik script..

 

Regards

Labels (1)
2 Solutions

Accepted Solutions
Kashyap_R
Partner - Specialist
Partner - Specialist

Hi

Try this 

 

Sectio:
Load * Inline [
Dat
R191024];

Sect2:

Load Dat,
Left(Dat,1) as request,
mid(Dat,2,2) as Year1,
Month(Date#(mid(Dat,4,2),'MM')) as Month1,
mid(Dat,6,2) as Day1
Resident Sectio;

 

Hope it helps 

Thanks

Thanks and Regards
Kashyap.R

View solution in original post

tresesco
MVP
MVP

An easier one might be like:

Year(Date#(left('R191024_000008',5), 'RYYMM')) as  Year,

Month(Date#(left('R191024_000008',5), 'RYYMM')) as  Month

View solution in original post

2 Replies
Kashyap_R
Partner - Specialist
Partner - Specialist

Hi

Try this 

 

Sectio:
Load * Inline [
Dat
R191024];

Sect2:

Load Dat,
Left(Dat,1) as request,
mid(Dat,2,2) as Year1,
Month(Date#(mid(Dat,4,2),'MM')) as Month1,
mid(Dat,6,2) as Day1
Resident Sectio;

 

Hope it helps 

Thanks

Thanks and Regards
Kashyap.R
tresesco
MVP
MVP

An easier one might be like:

Year(Date#(left('R191024_000008',5), 'RYYMM')) as  Year,

Month(Date#(left('R191024_000008',5), 'RYYMM')) as  Month