SQL*Plus (MOSC)

MOSC Banner

how to get running total year month wise

edited Sep 26, 2023 7:42AM in SQL*Plus (MOSC) 5 commentsAnswered ✓

HI All,

Working in Oracle EBS

Version 12.2.10

My requirement is to get year wise running total

query

SELECT CUSTOMER_ID, YR, MNTH, AMOUNT

, sum(AMOUNT) over (order by YR, mnth rows unbounded preceding ) YTD_SALES

FROM

(

SELECT RA.SOLD_TO_CUSTOMER_ID CUSTOMER_ID,

to_char(trx_date,'MON-YY') MONTH_YR

,(to_char(trx_date,'YYYY-MM') ) MNTH_YR

,to_char(trx_date,'YYYY') YR

,TO_NUMBER(to_char(trx_date,('MM')) ) MNTH

,SUM(RACTL.EXTENDED_AMOUNT) AMOUNT

FROM RA_CUSTOMER_TRX_ALL RA

,RA_CUSTOMER_TRX_LINES_ALL RACTL

WHERE RA.CUSTOMER_TRX_ID = RACTL.CUSTOMER_TRX_ID

AND RA.ORG_ID = RACTL.ORG_ID  

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center