Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Highlighted
akpofureenughwu
Contributor III

Quarter Creation

How do I create a quarter period in my script. Please find the attached file for clarity. Thanks

Tags (1)
1 Solution

Accepted Solutions

Re: Quarter Creation

You can use Day() function for that:

NoConcatenate

LOAD [S/N],

    [Supply Field],

    If(Len(Trim(Region)) = 0, Peek('Region'), Region) as Region,

    Supplier,

    Type,

    [Daily Average],

    [Annual Cumm],

    Date(Num#(Date)) as Date,

    Month(Num#(Date)) as Month,

    'Q' & Ceil(Month(Num#(Date))/3) as Quarter,

    MonthName(Num#(Date)) as MonthYear,

    Year(Num#(Date)) as Year,

    Day(Num#(Date)) as Day,

    Value

I would suggest looking into a master calendar script for doing this:

Creating A Master Calendar

And for a list of date and time function, visit help:

Date and time functions ‒ QlikView

3 Replies

Re: Quarter Creation

This:

NoConcatenate

LOAD [S/N],

     [Supply Field],

     If(Len(Trim(Region)) = 0, Peek('Region'), Region) as Region,

     Supplier,

     Type,

     [Daily Average],

     [Annual Cumm],

     Date(Num#(Date)) as Date,

     Month(Num#(Date)) as Month,

     'Q' & Ceil(Month(Num#(Date))/3) as Quarter,

     MonthName(Num#(Date)) as MonthYear,

     Year(Num#(Date)) as Year,

     Value

akpofureenughwu
Contributor III

Re: Quarter Creation

Thanks Man. How about the day of the month in the script?

Re: Quarter Creation

You can use Day() function for that:

NoConcatenate

LOAD [S/N],

    [Supply Field],

    If(Len(Trim(Region)) = 0, Peek('Region'), Region) as Region,

    Supplier,

    Type,

    [Daily Average],

    [Annual Cumm],

    Date(Num#(Date)) as Date,

    Month(Num#(Date)) as Month,

    'Q' & Ceil(Month(Num#(Date))/3) as Quarter,

    MonthName(Num#(Date)) as MonthYear,

    Year(Num#(Date)) as Year,

    Day(Num#(Date)) as Day,

    Value

I would suggest looking into a master calendar script for doing this:

Creating A Master Calendar

And for a list of date and time function, visit help:

Date and time functions ‒ QlikView