Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

raZor
New Contributor II

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

2 Solutions

Accepted Solutions
Partner
Partner

Re: get month from string

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

MVP
MVP

Re: get month from string

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

Re: get month from string

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

MVP
MVP

Re: get month from string

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