Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to Retrieve Quarter from the Date field

How to retrieve the Quarter and period from the Date field?Please give me an example?

7 Replies
Not applicable
Author

Try this:


'Q' & CEIL(MONTH(DATE(Transaction_Date)/3) AS Transaction_Quarter


Not applicable
Author

Dear Mark,

Could you please explain this expression. When do you divide by 3. Is there should be a closing braces?

Not applicable
Author

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

prieper
Master II
Master II

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

Not applicable
Author

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

Anonymous
Not applicable
Author

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....

Anonymous
Not applicable
Author

This Calculate de Q1 Q2 Q3 Q4...

'Q' & CEIL(MONTH(Transaction_Date)/3)    AS Transaction_Quarter