Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Goodmorning all,
I have a question.
dependent on a variable - a date - I would like to determine the quarter of this date. Something like:
if mid( vVariable , 4, 2 ) between 01 and 03 then 'Q1';
elsif mid( vVariable , 4, 2 ) between 04 and 06 then 'Q2';
elsif mid( vVariable , 4, 2 ) between 07 and 09 then 'Q3';
elsif mid( vVariable , 4, 2 ) between 10 and 12 then 'Q4';
end if;
I tried the above in several formats, but keep getting no result.
Does anybodt have a suggestion?
Thanks in advance.
Hi,
Try this: 'Q' & CEIL(MONTH([DateField])/3) AS [Quarter]
Regards,
Sokkorn
IF (num(mid( vVariable , 4, 2 )) >= 1 AND num(mid( vVariable , 4, 2 )) <= 3, 'Q1',
IF (num(mid( vVariable , 4, 2 )) >= 4 AND num(mid( vVariable , 4, 2 )) <= 6, 'Q2',
IF (num(mid( vVariable , 4, 2 )) >= 7 AND num(mid( vVariable , 4, 2 )) <= 9, 'Q3',
IF (num(mid( vVariable , 4, 2 )) >= 10 AND num(mid( vVariable , 4, 2 )) <= 12, 'Q4'))))
Hi,
Try this: 'Q' & CEIL(MONTH([DateField])/3) AS [Quarter]
Regards,
Sokkorn
Brilliant - thanks