Re: ytd calculation

From: Mark D Powell <Mark.Powell2_at_hp.com>
Date: Wed, 3 Feb 2010 05:49:27 -0800 (PST)
Message-ID: <36d27339-3c89-4ed2-a2c5-8c06439085c5_at_g29g2000yqe.googlegroups.com>



On Feb 3, 6:19 am, raja <dextersu..._at_gmail.com> wrote:
> Hi,
>
> If, I want to calculate ytd ( year to date calculation ), then i have
> to sum up monthly then sum up for yearly.
> Eg : I have to calculate YTD as follows :
>
> GL Curr Day Amount Month YTD
> 5805 45454 1-Jan 5.23 5.23 5.23
> 5805 45454 2-Jan -4.52 0.71 5.94
> 5805 45454 3-Jan 25.3 26.01 31.95
> 5805 45454 4-Jan 10.53 36.54 68.49
> 5805 45454 5-Jan -1.88 34.66 103.15
>
> how can i do this ytd using rollup or group by clauses (i.e., i have
> to sum up for every row) ?
>
> Thanks.
>
> With Regards,
> Raja.

How about posting a the create table DDL with insert statements for the data. It would save a lot of time. However, what you want is unclear in that looking at your sample data you have what appear to be current, month, and YTD data columns so all you would need is to sum all three columns. A better explanation might also save someone from producing the wrong solution to what you really need.

HTH -- Mark D Powell -- Received on Wed Feb 03 2010 - 07:49:27 CST

Original text of this message