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.

1 Solution

Accepted Solutions
disqr_rm
Partner - Specialist III
Partner - Specialist III

Try:

'Q' & ceil(month(UCCDATE)/3)

View solution in original post

19 Replies
Anonymous
Not applicable
Author

I currently use the below formula. Hopefully there is a simpler way:

if(month(UCCDATE)='Jan','Q1',

if(month(UCCDATE)='Feb','Q1',

if(month(UCCDATE)='Mar','Q1',

if(month(UCCDATE)='Apr','Q2',

if(month(UCCDATE)='May','Q2',

if(month(UCCDATE)='Jun','Q2',

if(month(UCCDATE)='Jul','Q3',

if(month(UCCDATE)='Aug','Q3',

if(month(UCCDATE)='Sep','Q3',

if(month(UCCDATE)='Oct','Q4',

if(month(UCCDATE)='Nov','Q4',

if(month(UCCDATE)='Dec','Q4')))))))))))) as Quarter,



disqr_rm
Partner - Specialist III
Partner - Specialist III

Try:

'Q' & ceil(month(UCCDATE)/3)

ashfaq_haseeb
Champion III
Champion III

Try This coad, this might help you.

'Q' & ceil(month(UCCDATE)/3)

Not applicable
Author

How would you do it if your quarter only starts at april

Not applicable
Author

This works nicely other than getting just a blank "Q" on its own. Why am I getting that?

swuehl
MVP
MVP

Alex, you are only getting a 'Q' with no quarter number? Have you tried just using

ceil(month(DATE)/3) as Quarter,

to look if you got a number from that, if not, try just a month(DATE) and if this doesn't return a number than look at your DATE field. It mus be a recognozed QV date/timestamp type, i.e. must have a numerical representation.

Or am I misunderstanding your question?

Not applicable
Author

When I just use ceil(month(DATE)/3), I get just 1, 2, 3, 4.

Would it be doing this because I am using a list box? And I'm not doing it in the script?

And no, in the expression I get this: Q, Q1, Q2, Q3, Q4. I don't need the first Q value.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Because some of your dates are null. To filter them out use:

=if(len(DATE)>0, 'Q' & ceil(month(DATE)/3))

-Rob

Not applicable
Author

Great, thanks Rob. That did the trick.