how to add value from first row to second row
Hi All,
Oracle OPM
Version : 12.2.10
requirement is how to add from first row to second row likewise
date parameters can be two months or full year
first month will remain same
from second month should add first month and second month
from third month should add first month + second month and third month
for eample
month value
1 76767.5
2 107278.25
3 121514.25
result as it is for first line
1 76767.5 jan
2 184045.75 jan+feb
3 305560 jan+feb+mar
please i need some help to achieve
query
SELECT MNTH, mnth_yr,
( CASE WHEN MNTH <= mnth_yr THEN sum(AMOUNT) ELSE 0 END ) AS ytd_jan
FROM
(
SELECT R.BILL_TO_CUSTOMER_ID, TO_NUMBER(TO_CHAR(TRX_DATE,'MM')) MNTH, SUM(EXTENDED_AMOUNT) AMOUNT ,to_number(to_char(trx_date,'MM')) MNTH_YR