Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
The #1 reason QlikView customers adopt Qlik Sense is a desire for a modern BI experience. Read More
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator II
Creator II

How can I separate a Year/Month field into two fields in script

I have a field named [Year/month] and the values look like this: 2018/01  I need to pull out the Year value and the Month value as a name.  I want to do this in the script.  How can I do this?

10 Replies
Highlighted
MVP
MVP

Date#([Year/month],'YYYY/MM') as [Year/month],

Year(Date#([Year/month],'YYYY/MM')) as Year,

Month(Date#([Year/month],'YYYY/MM')) as Month

Highlighted
Creator III
Creator III

use the subfield function in the expr where ever you would like to

subfield([Year/month],'/',1) for field Year and subfield([Year/month],'/',2)  for Month

Highlighted
Specialist
Specialist

Left([Year/month], 4) AS MyYear, Right([Year/month], 2) AS MyMonth

Highlighted
Creator II
Creator II

I need the MyMonth to be Month name and not Month num.

Highlighted
Creator III
Creator III

use inline load  as

Mnth_Map:

Mapping Load * INLINE

[ Mnth_Num,Mnth_Name

1, Jan

2,Feb

3,Mar

]

then use

ApplyMap('Mnth_Map',subfield([Year/month],'/',2) ) as Month_Name,

subfield([Year/month],'/',1)  as Year

Highlighted
MVP
MVP

Have you tried as per my answer?

You will get something like below.

Capture.JPG

Highlighted
Specialist
Specialist

Month(MakeDate(2018,Right([Year/month], 2))) as MyMonthName

Highlighted
Creator II
Creator II

I need the full moth name.

Highlighted
MVP
MVP

Data:

Load

Date#([Year/month],'YYYY/MM') as [Year/month],

Year(Date#([Year/month],'YYYY/MM')) as Year,

Date(Date#(Month(Date#([Year/month],'YYYY/MM')),'MMM'),'MMMM') as Month

Inline

[

Year/month

2018/01

2018/02

2018/03

];