Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

DATE - QUARTER

Hi..

i am new to qlikview ,trying to define quarter using the below script is any limitation in doing this ways,

'Q' & CEIL(MONTH(DATE(DATE#((left(Cdate,6)),'DDMMYY'),'DD-MM-YYYY'))/3) AS QUATER

Thanking You

Vianyagam

Labels (1)
1 Solution

Accepted Solutions
tresB
Champion III
Champion III

Yes. This would be a simply text representation of your quarters which would not respond to qlikview date functions. For ex: if you try to use AddMonths() function to a generated value Q1, would not get desired output. This is because, here Q1 is just a text. However, if you create quarters using QuarterName(), you get a value with underlaying numeric/date values. And those values (would look like -  'Oct-Dec 2013') respond to other date functions (like AddMonths()) to produce desired output.

Note: If you are bothered about the presentation (prefer- 'Q4' over  'Oct-Dec 2005'), you might think of using Dual() and enjoy both the facilities.

View solution in original post

7 Replies
MK_QSL
MVP
MVP

Looks like you have (may be) timestamp ....

you can also use FLOOR function to get Date from TimeStamp...

Try as below in text box

='Q' & CEIL(MONTH(Date(FLOOR(NOW())))/3)

anbu1984
Master III
Master III

'Q' & Ceil(Mid(Cdate,3,2)/3)

tresB
Champion III
Champion III

Yes. This would be a simply text representation of your quarters which would not respond to qlikview date functions. For ex: if you try to use AddMonths() function to a generated value Q1, would not get desired output. This is because, here Q1 is just a text. However, if you create quarters using QuarterName(), you get a value with underlaying numeric/date values. And those values (would look like -  'Oct-Dec 2013') respond to other date functions (like AddMonths()) to produce desired output.

Note: If you are bothered about the presentation (prefer- 'Q4' over  'Oct-Dec 2005'), you might think of using Dual() and enjoy both the facilities.

its_anandrjs
Champion III
Champion III

Update new change

NO error  in the script you can use it it self or may be

'Q' & CEIL(MONTH(DATE(DATE#((left(Cdate,6)),'DDMMYY'),'DD-MM-YYYY'))/3) AS QUATER


Or


Try like


='Q' & CEIL(MONTH(DATE#(Mid(Cdate,3,2),'MM'))/3)


Ex:-


='Q' & CEIL(MONTH(DATE#(Mid(28042014,3,2),'MM'))/3)



vijetas42
Specialist
Specialist

Hi,

Try this,

'Q'&Ceil ([Month_Field]/3) as Qtr1

Not applicable
Author

hi

Thanks all for  the valuable response .

i tried the quarter name() but the o/p for the first quarter is  ddifferent then the actual month.

Attaching herewith is the data and Qlikview .

also can anyone suggest for starting up with YTD and MTD

Thanking You

Vinayagam

tresB
Champion III
Champion III

QuarterName() takes date as parameter not month. Hence try like:

QuarterName(DATE(DATE#((left(Cdate,6)),'DDMMYY')))  AS QUATER