Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Pulling year and month from dates?

Are there any functions in Qlikview that will allow me to select my data depending on the month and year that it's associated with? I have a few fields with dates but I don't know how it's possible to extract some of that information to create another field (i.e. have a field for months: Jan, Feb, mar and a field for year: 2005, 2006, 2007, etc)

Thank you!

3 Replies

Re: Pulling year and month from dates?

Hi,

Sure, there are quite a bunch! Take a look at the following sample code, based on the "DateField" field that stores values like "06/09/2012" in the form "DD/MM/YYYY":

Calendar:

LOAD DateField AS CompleteDate,

     Month(DateField) AS MonthField,

     Year(DateField) AS YearField,

     Day(DateField) AS DayField

FROM File.qvd (qvd);

Hope that helps.

Miguel

Not applicable

Re: Pulling year and month from dates?

Hi Miguel,

(Forgive me but I just started using Qlikview)

So I pasted what you wrote into Edid Script and replaced DataField with the name of one of the date fields within a table I'm working on. So I get something that looks like this:

Calendar:

LOAD PlacedDate AS CompleteDate,

     Month(PlacedDate) AS MonthField,

     Year(PlacedDate) AS YearField,

     Day(PlacedDate) AS DayField

FROM File.qvd (qvd);

It fails when I hit Reload so I'm assuming that this script alone won't create the qvd file? If so, how would I create one?

Not applicable

Re: Pulling year and month from dates?

Hi,

Directly place the below columns into your existing table, then it works fine.

    PlacedDate,

     Month(PlacedDate) AS MonthField,

     Year(PlacedDate) AS YearField,

     Day(PlacedDate) AS DayField

Community Browser