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

Announcements
Talend Cloud AWS EU Scheduled Outage: Starting Tues 26 May 21:00 CEST with expected completion Wed 27 May 01:00 CEST
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Not getting the correct quarter number

Hi Guys,

I have the field quarter that doesn't show the correct quarter numbers:

Based on the script below,

'Q' & Ceil(Month(Date(Date#(OrderDate, 'YYYYMMDD'),'DD-MM-YYYY') /3)) as Quarter,

OrderDate is a string therefore I used the Date# to translate it to a date.

I get these results

What am I doing wrong?

Cheers!

iSam

Labels (1)
1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hi Isam,

I cannot see the attached image, but you have a parenthesis moved, the correct syntax is to divide the month into 3:

'Q' & Ceil(Month(Date(Date#(OrderDate, 'YYYYMMDD'),'DD-MM-YYYY')) /3) AS Quarter,

Hope that helps.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

View solution in original post

2 Replies
Miguel_Angel_Baeyens

Hi Isam,

I cannot see the attached image, but you have a parenthesis moved, the correct syntax is to divide the month into 3:

'Q' & Ceil(Month(Date(Date#(OrderDate, 'YYYYMMDD'),'DD-MM-YYYY')) /3) AS Quarter,

Hope that helps.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

You have a misplace ) sign.

'Q' & Ceil(Month(Date#(OrderDate, 'YYYYMMDD')) / 3)

You could also use

QuarterName(Date#(OrderDate, 'YYYYMMDD'))

Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein