Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

YYYYMM as month and year

Dear all,

I have a file where the period is stored as YYYYMM (e.g.201304).

I want to change this into a date field where I can then later on also calculate MAT, YTD, etc.

Do you have any advice what and how to do?

thank you

5 Replies
narender123
Specialist
Specialist

Hi,

Date#(fieldname) as Date

Narender

Not applicable
Author

Add the following to you script:

SET DateFormat='YYYYMM';

And then use the date# function to separate it.

The following example works:

eg.

DateYear:

LOAD* Inline [

YYYYMM, Value

201304, 1

201201, 2

];

Load YYYYMM,

           Date#(YYYYMM) as DDate,

           Month(Date#(YYYYMM)) as DMonth,

           Year(Date#(YYYYMM)) as DYear

Resident DateYear;

Not applicable
Author

Hope it will help u..

Date(MakeDate(Left(period,4),Right(period,2),'01'),'DD/MM/YYYY') as DATE

Regards-Bika

Not applicable
Author

This was working, but only with 'MM/YYYY' instead of 'DD/MM/YYYY'

thank you

neetu_singh
Partner - Creator III
Partner - Creator III

Hi,

 

DATE (MakeDate(LEFT(YYYYMM,4),RIGHT(YYYYMM,2),'01'),'DD/MM/YYYY') AS DATE

Regards

Neetu