Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

biob_stein
Contributor

First Quarter (Q1) begins with April

Dear Community,

i am generating quarters on my dates and tried these solutions:

'Q'&If(Month(QuarterStart(DATE))='1',4,Div(Month(QuarterStart(DATE)),3)) as DATE_QUARTER;

or

if(len(DATE)>0, 'Q' & ceil(month(DATE)/3),ceil(month(DATE)/3)) as DATE_QUARTER;

Unfortunately the first quarter (Q1) begins all the time with April.

It should begin with January! How can i achieve this?

Please help

1 Solution

Accepted Solutions
sebastianlettne
Contributor

Re: First Quarter (Q1) begins with April

Hi,

this should work

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

3 Replies
sebastianlettne
Contributor

Re: First Quarter (Q1) begins with April

Hi,

this should work

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

Frank_Hartmann
Honored Contributor

Re: First Quarter (Q1) begins with April

Hi Paul:

try like this:

TempCalendar: 

LOAD

$(vDateMin) + RowNo() - 1 AS DateNumber, 

Date($(vDateMin) + RowNo() - 1) AS TempDate

AUTOGENERATE 1 

WHILE $(vDateMin)+IterNo()-1<= $(vDateMax);

MasterCalendar: 

LOAD

'Q' & Ceil(Month(TempDate)/3) AS CalendarQuarter

RESIDENT TempCalendar ORDER BY TempDate ASC;

DROP TABLE TempCalendar; 

hope it helps!

It’s never over until it’s over
buzzy996
Honored Contributor II

Re: First Quarter (Q1) begins with April

try this way,

Ceil(Month([Order Date])/3) As Quarterly,

Community Browser