Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How to retrieve the Quarter and period from the Date field?Please give me an example?
Try this:
'Q' & CEIL(MONTH(DATE(Transaction_Date)/3) AS Transaction_Quarter
Dear Mark,
Could you please explain this expression. When do you divide by 3. Is there should be a closing braces?
I use this expression in our reload script to generate a quarter (Q1/Q2/Q3/Q4) for the transaction date.
The expression takes divides the monthnumber by 3 and always rounds upwords CEIL() -> ceiling
For example
Monthnumber(5-10-2008)->10
10/3=3.33
Ceil(3.33)=4
Hi,
QuarterName(YourDate) is also a nice function and delivers a date, which then might be used like other numeric data (sorting, filtering, >, etc)
HTH
hi mjanssen,
Thanks a lot for your simple trick.I was worrying in sqldeveloper,there also i have resolved it in the same way.
Regards,
Sushma K
Mark Janssen escribió:
Try this:
'Q' & CEIL(MONTH(DATE(Transaction_Date)/3) AS Transaction_Quarter
'Q' & CEIL(MONTH(DATE(Transaction_Date)/3)) AS Transaction_Quarter ------ This Calculate all Q from your data like this Q1 Q2 Q3 Q4 Q5....
This Calculate de Q1 Q2 Q3 Q4...
'Q' & CEIL(MONTH(Transaction_Date)/3) | AS Transaction_Quarter |