Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

How to create quarter like this : Q1 = March, April & may

hello,
I would like to create quarter with differents months like this :
Q1 = March, April & may
Q2= June, july & August
Q3 = Sept, oct, & november
Q4 = december, january & february
I know theses functions :
'Q' & Ceil(Month(date_calendrier)/3) AS Trimestre_Calendrier
QuarterName (date_calendrier) as Trimestre_Année_calendrier
QuarterStart (date_calendrier) as Début_Trimestre_Calendrier,  
But I don't know how to adapt it in order to make the quarters I wantp>
Someone could help me?
Thanks
Stéphane
Tags (1)
1 Solution

Accepted Solutions
Not applicable

Re: How to create quarter like this : Q1 = March, April & may

Try using

'Q' & Ceil(Month(AddMonths(date_calendrier, -2))/3) AS Trimestre_Calendrier

QuarterName (AddMonths(date_calendrier, -2)) as Trimestre_Année_calendrier

QuarterStart (AddMonths(date_calendrier, -2)) as Début_Trimestre_Calendrier,

6 Replies
thomas_skariah
Contributor III

Re: How to create quarter like this : Q1 = March, April & may

Hi Stephane,

You can try using inline like

Load * Inline [

Month,Quarter

Mar,Q1

Apr,Q1

May,Q1

Jun,Q2

Jul,Q2

Aug,Q2

Sep,Q3

Oct,Q3

Nov,Q3

Dec,Q4

Jan,Q4

Feb,Q4 ];

Regards,

Tom

Not applicable

Re: How to create quarter like this : Q1 = March, April & may

Try using

'Q' & Ceil(Month(AddMonths(date_calendrier, -2))/3) AS Trimestre_Calendrier

QuarterName (AddMonths(date_calendrier, -2)) as Trimestre_Année_calendrier

QuarterStart (AddMonths(date_calendrier, -2)) as Début_Trimestre_Calendrier,

Not applicable

Re: How to create quarter like this : Q1 = March, April & may

thank you Ducati.

it runs well now

Not applicable

Re: How to create quarter like this : Q1 = March, April & may

No thanks. Glad it works. Could you please mark the answer as the correct one?

Not applicable

Re: How to create quarter like this : Q1 = March, April & may

Hi Ducati,

I would like ti mark the answer, but I don't know why, the button has disapear of the screen... so I can't do that!

ScreenHunter_02 Oct. 18 20.24.gif

Not applicable

Re: How to create quarter like this : Q1 = March, April & may

You could also try this way - adding below to script & add / delete the months you want in that quarter;

IF (MIXMATCH(LEFT(MONTHNAME(BOOKED_DATE),3),'Jan','Feb','Mar')>0,'Q1')
AS QTR_BOOKED


Community Browser