Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Highlighted
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));