I had a "fine" report for current year revenue, but of course that's not
good enough :)
I was asked to bring in 2 more columns of last year revenue and year before
that.
Yr2003, Yr2004, 2005-1, 2005-2,.. 2005-12, Yr2005
I did a union for the prior year(s) data as well as the total for current
year. Unfortunatly the sort of columns in the cross tab goes like this:
2003, 2004, 2005 - 1, 2005 -10, 2005 - 11, 2005 -2
How do I group by for correct output?
I use to have this:
ltrim(rtrim(Str(year(orders.shipdate)))) +' -
'+rtrim(ltrim(str(datepart(M,orders.shipdate))) ) ColLabel,
datepart(M,orders.shipdate) sortby,
I took out the sortby column all together because I need just the total for
years 2003, 2004.
Any ideas for a Monday morning problem?
TIA"__Stephen" <srussell@.transactiongraphics.com> wrote in message
news:%23R2AN%23C9FHA.2716@.TK2MSFTNGP11.phx.gbl...
>I had a "fine" report for current year revenue, but of course that's not
>good enough :)
> I was asked to bring in 2 more columns of last year revenue and year
> before that.
> Yr2003, Yr2004, 2005-1, 2005-2,.. 2005-12, Yr2005
I took each segment of the union on it's own merit
( datepart(yy,Orders.shipdate) *-2) --for Yr2003
( datepart(yy,Orders.shipdate) *-1) --for Yr2004
( datepart(yy,Orders.shipdate) + datepart(mm,Orders.shipdate)) -- for each
month of current year
( datepart(yy,Orders.shipdate) * 2) -- For total of current year
seems to work now.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment