Page 1 of 1

Determining quarter number

Posted: Tue May 06, 2008 6:08 am
by Offshored2002
Is there an easy way to determine the number of quarters between two dates which could be added as a column derivation in say, a COPY stage:
For example:
NQTRS between (2007-03-31 - 2008-03-31) + 1 = 5 (absolute value)

Those of you familar with SAS, the code would be
NQTRS = INTCK('QTR','31Mar2007'd,'31Mar2008'd) + 1;
and would return 5

Posted: Tue May 06, 2008 6:48 am
by ArndW
Convert your dates to internal format, then use OCONV(In.Date1,'DQ') to get the quarter number and OCONV(In.Date1,'DY') to get the year and then (Date1Q+(Date1Y*4))-(Date2Q+(Date2Y*4))

Posted: Tue May 06, 2008 7:28 am
by kcbland
A Time dimension would be helpful.

Posted: Tue May 06, 2008 3:45 pm
by ray.wurlod
Moderator: please move to parallel forum