Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Quarter Function

How can I extract quarter from a date column? I dont like the format of QuarterName function of QlickView. I want a simple display like Q1, Q2, Q3, Q4. Any pointers?

Thanks,

Dinesh.

19 Replies
gaurav2017
Creator II
Creator II

How about if the Calendar starts from April. Please don't show me the inline method.

I am using this below script. But it's incomplete i guess.

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

Regards,

swuehl
MVP
MVP

There are probably several approaches,

='Q' & ceil((mod((Month(Date)+8),12)+1)/3)

='Q' & pick(Month(Date),4,4,4,1,1,1,2,2,2,3,3,3)

or using a Mapping Table

MAP:

MAPPING LOAD * INLINE [

Month, Quarter

1,Q4

2,Q4

3,Q4

4,Q1

5,Q1

6,Q1

7,Q2

8,Q2

9,Q2

10,Q3

11,Q3

12,Q3

];

MAP Quarter using MAP;

LOAD

Month(Date) as Quarter,

...

gaurav2017
Creator II
Creator II

Swuehl,

Thanks dear, It works.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Another alternative would be:

='Q' & Ceil(Month(AddMonths(Date,-3))/3)

-Rob

Not applicable
Author

Forma mais simples, rápida e funcional.

Serviu perfeitamente para solucionar o meu problema.

Obrigado Rob.

Anonymous
Not applicable
Author

What ?

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

De nada.

-Rob

Anonymous
Not applicable
Author

Thank you! This worked nicely for me as my company has a different Fiscal Calendar so I was able to set the Quarters as needed.

Ksrinivasan
Specialist
Specialist

Hi sir,

instead of lengthy, you can use as script as below:

'Q' & Ceil(Month(AddMonths(DATE,-3))/3) as QUA ,

here DATE means your DATE field,

then followed that another requirement may be raise as Fiscal year,

for Q1, Q2, Q3 = current year + Next year (2019-2020)

for Q4 = Last year + Current Year (2018-2019),

 

for that

if(QUA='Q4', Year(DATE)-1 &'-'& Year(DATE), if(QUA='Q3', Year(DATE) &'-'& (Year(DATE)+1),if(QUA='Q2', Year(DATE) &'-'& (Year(DATE)+1),if(QUA='Q1', Year(DATE) &'-'& (Year(DATE)+1),'')))) as Fiscal Year,

Result will be:

 

Enjoy with qlik,

 

K. Srinivasan.

Ksrinivasan
Specialist
Specialist

Result will be:

clipboard_image_0.png

K. Srinivasan.