Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Date field from Period field

Hi,

Is it possible to make a date field from period field?

Like 01.01.2018 from 01.2018

       DD.MM.YYYY     MM.YYYY

Thanks

1 Solution

Accepted Solutions
OmarBenSalem

Load date(MonthStart(Date#(dateField,'YYYYMM')),'DD.MM.YYYY') as NewDateField Inline [

dateField

201801

201802

201803

201804

];

result:

Capture.PNG

View solution in original post

18 Replies
juraj_misina
Luminary Alumni
Luminary Alumni

Yes, you can use Date#() function for this. It takes two parameters: a string with date value and a string defining date format. So in your exmple:

Date#('01.2018', 'MM.YYYY')

Of course you can use field names as the first parameter:

Date#(DateField, 'MM.YYYY')

Hope this helps

Juraj

Chanty4u
MVP
MVP

try this

A:

load * Inline

[

OrdDate

01.2018

];

LOAD * ,

Date(Date#(OrdDate,'MM.YYYY'),'DD.MM.YYYY') as New

Resident A;

Anonymous
Not applicable
Author

I don't have date field. I have only Period field from which i want to make a date field.

Date# just generate the same period

Anonymous
Not applicable
Author

By doing so, i got blank output.

juraj_misina
Luminary Alumni
Luminary Alumni

Date#() generates the same period, but makes Qlik understand it is a date field. So after using Date#() on your period field you can work with it as with date field. Try Chanty's example to see for yourself

Date(Date#(PeriodField, 'MM.YYYY'), 'DD.MM.YYYY')

OmarBenSalem

can u share 5 dates you already have? exactlly how they're written; this could help us

Mark_Little
Luminary
Luminary

Hi,

You need to complete the date then change it,

DATE(DATE#('01.'&DateField,'DD.MM.YYYY'),'DD.MM.YYYY') AS NewDate


This will make all your period the 1st of the month.


Mark

Miguel_Angel_Baeyens

Then please share some real input data as this works for me.

Anonymous
Not applicable
Author

I have period field in below format

a.PNG