Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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

Auto generate dates on Qlikview

Hey guys, I need to create a database with dates directly on Qlikview, from jan/1/2008 until today on Qlikview, and I need it to be created day by day, and month by month. How do I do that????

1 Solution

Accepted Solutions
yavoro
New Contributor III

Re: Auto generate dates on Qlikview

try this script:

Dates:

Load

  Date(Date,'YYYYMMDD') as DateId,

  Date,

  Date - MakeDate(Year(Date),01,01) + 1  AS DayInYear,

  Year(Date) AS Year,

  Month(Date) AS MonthName,

  Month(Date) & ' ' & Year(Date) AS MonthNameYear,

    Ceil(Month(Date)) as Month,

  Week(Date) AS WeekInYear,

  Day(Date) AS DayInMonth,

  WeekDay(Date) AS DayInWeek,

  QuarterName(Date) AS QuarterNameYear,

  SubField(QuarterName(Date),' ',1) AS QuarterName,

  'Q' & Ceil(Month(Date)/3) as Quarter;

Load

  AddMonths(today(),12) - recno() AS Date

Autogenerate (AddMonths(today(),12) - MakeDate(2012,01,01));

1 Reply
yavoro
New Contributor III

Re: Auto generate dates on Qlikview

try this script:

Dates:

Load

  Date(Date,'YYYYMMDD') as DateId,

  Date,

  Date - MakeDate(Year(Date),01,01) + 1  AS DayInYear,

  Year(Date) AS Year,

  Month(Date) AS MonthName,

  Month(Date) & ' ' & Year(Date) AS MonthNameYear,

    Ceil(Month(Date)) as Month,

  Week(Date) AS WeekInYear,

  Day(Date) AS DayInMonth,

  WeekDay(Date) AS DayInWeek,

  QuarterName(Date) AS QuarterNameYear,

  SubField(QuarterName(Date),' ',1) AS QuarterName,

  'Q' & Ceil(Month(Date)/3) as Quarter;

Load

  AddMonths(today(),12) - recno() AS Date

Autogenerate (AddMonths(today(),12) - MakeDate(2012,01,01));