Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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,
Try:
'Q' & ceil(month(UCCDATE)/3)
Try This coad, this might help you.
'Q' & ceil(month(UCCDATE)/3)
How would you do it if your quarter only starts at april
This works nicely other than getting just a blank "Q" on its own. Why am I getting that?
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?
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.
Because some of your dates are null. To filter them out use:
=if(len(DATE)>0, 'Q' & ceil(month(DATE)/3))
-Rob
Great, thanks Rob. That did the trick.