Categories
- All Categories
- 75 Oracle Analytics News
- 7 Oracle Analytics Videos
- 14K Oracle Analytics Forums
- 5.2K Oracle Analytics Idea Labs
- Oracle Analytics User Groups
- 40 Oracle Analytics Trainings
- 59 Oracle Analytics Data Visualizations
- 2 Oracle Analytics Data Visualizations Challenge
- 3 Oracle Analytics Career
- 4 Oracle Analytics Industry
- Find Partners
- For Partners
SUM values from last 3months for each branch
Hi,
I have problem.
In analysis I have columns like: Year, Months and measure.
Measure is MEASURE_1#1 from rpd and it has MAX aggregation (set in rpd).
It look like:
Now I want to add second columns and create formule where:
for 2017 M12 I want SUM (m10+m11+12), for 2017 M11 I want sum (m09,m10,m11) etc.
How can I do this?
Answers
-
You need to use time series function - period rolling - see below link.
0 -
Ok, I have MEASURE_1 with MAX aggregation and when I'm using PERIODROLLING like: PERDIOROLLING(MEASURE_1, -2,0) in results i see MAX VALUE from 3last months.
I must set max in rpd but on analysis I want to sum last 3months
0 -
Sorry, maybe being slow, suffering from man flu here - are you asking for sum of last 3 max values?
Or do you just want sum of last three months?
0 -
Yes, I am asking for sum of last 3 MAX values.
My mistake.
0 -
Would this work for you - the principal of it and the underlying database; -
0 -
Because of MAX you need to do the sum yourself, so all you need is to use AGO twice to get the M-2 and M-1 value and add the current one.
So your formula will be <measure> + AGO( measure M-1 ) + AGO( measure M-2 )
this isn't a valid syntax, it just gives you the idea on how to do
0 -
you want 3-month running sum of max values by month ...
you've got the max already so do an MSUM(max,3) and make sure your months are sorted correct ...
Example
This example shows a query that uses the MSUM function, along with example query results.
select month, revenue, MSUM(revenue, 3) as 3_MO_SUM from sales_subject_area
Result:
MONTH REVENUE 3_MO_SUM
JAN 100.00 100.00
FEB 200.00 300.00
MAR 100.00 400.00
APRIL 100.00 400.00
MAY 300.00 500.00
JUNE 400.00 800.00
JULY 500.00 1200.00
AUG 500.00 1400.00
SEPT 500.00 1500.00
OCT 300.00 1300.00
NOV 200.00 1000.00
DEC 100.00 600.00
NOTE: M01/JAN or ANY first value MSUM(Measure,#) = Measure ... keep that in mind if you are looking to bring forward an MSUM for your MO1/JAN
0