Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
March 11, 2PM EST: Do More with Qlik - Getting Started wtih Qlik Sense SaaS - Redux. 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 (3)
2 Solutions

Accepted Solutions
kashyap
Partner
Partner

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

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
Partner
Partner

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

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