Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
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
1 Solution

Accepted Solutions
Not applicable
Author

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,

View solution in original post

6 Replies
thomas_skariah
Creator III
Creator III

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
Author

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
Author

thank you Ducati.

it runs well now

Not applicable
Author

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

Not applicable
Author

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
Author

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