Rolling Sum

Hi all,
My dashboard contains a prompt to choose a year which when selected needs to display the rolling sum of revenue for previous 2 years including the present.
For instance if the the year chosen is 2008, i need to get the rolling sum of the Revenue'08 +'07+'06.
The catch is i cant use AGO function since i need to perform Year to Date, QTD and MTD upon this rolling sum and OBIEE doesnt permit to use nested time series functions upon varying levels. I mean MTD ( Ago(Revenue, Year,1)) is not permitted.
We tried this FILTER function to achieve this but it didnt help .
FILTER(Sales."Fact - Sales"."$ Revenue" USING Sales."Fact - Sales"."Year id1" - Sales."Fact - Sales"."Year id2" BETWEEN -(1) AND 3)
the corresponding query with physical sources is
FILTER(sum(Fact_W_SALES_F.DOLLARS) USING Dim_W_DAY_D.YEAR_NUM - Dim_W_DAY_D_1.YEAR_NUM between -1 and 3)
Someone please clarify upon this....
thanks,
Sid

hi,
for rolling sum try this following blog
http://shivabizint.wordpress.com/2008/09/19/rolling-months-data-for-year-month-prompt-in-obie
for your requirement try the following
in dashboard prompt year column value assign to presentation variable var1.
Measure column write the following formula
(case when calendar.year=@{var1} then "Sales Facts"."Amount Sold" end )+(case when calendar.year=(@{var1}-1) then "Sales Facts"."Amount Sold" end)+(case when calendar.year=(@{var1}-2) then "Sales Facts"."Amount Sold" end)
hope it works for you
Regards
Naresh
Edited by: Naresh Meda on Nov 6, 2008 9:27 PM
Edited by: Naresh Meda on Nov 6, 2008 9:32 PM
Edited by: Naresh Meda on Nov 6, 2008 9:37 PM

Similar Messages

  • New column - all-time rolling sum in Repository

    Hi all
    I need to build a new column in the repository.(ALL TIME ROLLING SUM TO DATE) and # Month Roll over on that.
    I am looking for a way to easily compute rolling sums (etc.) for ranges of dimensional values that are not included in the result set.
    I want to show a table of monthly unit count for 6 months:
    I have the values forall months ,starting from years 2000.
    Month unit Count
    Jan07 100
    Feb07 150
    Mar07 - 100
    Apr07 125
    May07 - 200
    Jun07 210
    In another column I want to show an all-time rolling sum of the transaction activity
    (sum the metric for all rows in the fact table <= the month in the row of the report).
    Month Unit Count Rolling Sum To Date (Balance) 3 month Rollover
    Jan07 100 3400
    Feb07 150 3550
    Mar07 100 3650 10600
    Apr07 125     3775 10975
    May07 200 3975 11400
    Jun07 210 4185 11935
    I tried RSUM for Rolling Sum To Date, but it dosent give rolling sum values above the considered result set time period.
    Immediate help is appreciated, kind of urgent help required.
    Thanks in advance.
    Edited by: user11939829 on Sep 16, 2010 10:20 AM

    Hi Deepak,
    When i gave the example i forgot to add that i am showing the pivot chart in the report and showing the RSUM in Line Graph for 3 years..where i have year at the column and i have one dimension at the page section of the prompt.
    So i m just showing the line graph where i have RSUM at the Vertical axis...Month at the horizontal Axis.
    Sorry for the confusion

  • Creating Rolling Sums in Reports

    If the underlying database does not having rolling sums computed for you, how can you report rolling sums?  I tried to use the runningsum function but have no dimension to make the sum reset.  If I have a table in the report like:
    Customer   Month   Sales 
    A               Jan       1
    A               Feb       1
    A               Mar       1
    A               Apr        1
    A              May        1
    A              Jun         1
    B               Jan        1
    B               Feb       1
    B               Mar       1
    B               Apr        1
    B              May        1
    B              Jun         1
    How do i get a running 3 month sum by Customer like:
    Customer   Month   Sales   3 Month RunningSum
    A               Jan       1           1
    A               Feb       1           2
    A               Mar       1           3
    A               Apr        1           1
    A              May        1          2
    A              Jun         1          3
    B               Jan        1          1
    B               Feb       1          2
    B               Mar       1          3
    B               Apr        1          1
    B              May        1         2
    B              Jun         1         3
    Thanks,
    Jimmy

    I found a solution. Create several variables such as Previous1Month = previous([MetricName])
    Previous2Month = previous([Previous1Month])
    Previous3Month = previous([Previous2Month])
    PreviousXMonth = previous([Previous(X-1)Month])
    To create a rolling 3 month, you just create another variable
    Rolling3Month = MetricName + Previous1Month + Previous2Month
    Of course this becomes very tidious with lots of metrics and variation of grains(wkly, monthly, quarterly...).  That's why you would want your underlying data model to do this and have the etl do all the dirty work. =)
    Thanks,
    Jimmy

  • Creating Rolling Sum Measures

    Hi,
    I am pretty new to OBIEE and am trying to create rolling sum measures (rolling 3 months sum ).
    Can anyone help me out in this. I searched on the web and couldn't locate the correct article.
    Thanks,
    Anand

    Hello user,
    Please use the below link which is posted by shiva for calculating rolling months....
    http://shivabizint.wordpress.com/2008/09/19/rolling-months-data-for-year-month-prompt-in-obiee/
    Hope its helpful.
    Thanks

  • Need to get rolling sum year wise in a query.

    Hi all,
    I have a table with monthid and amt columns. values are like
    200501 5
    200502 6
    200503 6
    200601 7
    200602 8
    200603 9
    Like this i have data for all months in year. now i need to get rolling sum year and
    month wise. the output should be like
    200501 5
    200502 11
    200503 17
    200601 7
    200602 15
    200603 24
    please help me out to write a query for this.
    Thanks,
    Chandu

    May be you want this
    dev>select deptno,ename, sal,
      2                    sum(sal)over(partition by deptno order by ename)as sum_on_dept
      3                 from emp;
        DEPTNO ENAME                                                     SAL SUM_ON_DEPT
            10 CLARK                                                    2450        2450
            10 KING                                                     5000        7450
            10 MI_LL_ER                                                 1300        8750
            10 T*_1NU                                                   2000       10750
            20 ADAMS                                                    1100        1100
            20 FO__RD                                                   3000        4100
            20 JONES                                                    2975        7075
            20 SCOTT                                                    3000       10075
            20 SH_*U                                                    3200       13275
            20 SMITH                                                     800       14075
            30 ALLEN                                                    1600        1600
            30 BLAKE                                                    2850        4450
            30 JAMES                                                     950        5400
            30 MARTIN                                                   1250        6650
            30 TURNER                                                   1500        8150
            30 WARD                                                     1250        9400
            30 DEEP                                                   3000       12400
               D.EV                                                     5000        5000

  • Rolling Sum by dynamic range of data

    Hello guys
    I have a report that looks like this:
    Year       Month           Local Cost
    2005        1                   100
    2005        2                   10
    2005        3                   200
    2005        4                   5
    2005        5                   30
    2005        6                   100
    2005        7                   50
    2005        8                   60
    2005        9                   120
    2005        10                  10
    2005        11                  200
    2005        12                  50
    2006        1                   10
    2006        2                   80
    2006        3                   20
    2006        4                   50
    2006        5                   300
    2006        6                   10
    2006        7                   50
    2006        8                   60
    2006        9                   150
    2006        10                 100
    2006        11                 200
    2006        12                  5Now I need to create a new column called 'Rolling 12 month cost' that for each month, it gives the total cost of that month plus the other 11 months' total prior, so the report should look like this:
    Year       Month           Local Cost        R12 Cost
    2005        1                   100              100
    2005        2                   10                110
    2005        3                   200              310
    2005        4                   5                  315
    2005        5                   30                345
    2005        6                   100              445
    2005        7                   50                495
    2005        8                   60                555
    2005        9                   120              675
    2005        10                  10               685
    2005        11                  200             885
    2005        12                  50               935
    2006        1                   10                845 (sum of month 1 2006 to month 2 2005)
    2006        2                   80                865 (sum of month 2 2006 to month 3 2005)
    2006        3                   20                Same idea as above
    2006        4                   50                Same idea as above
    2006        5                   300              Same idea as above
    2006        6                   10                Same idea as above
    2006        7                   50
    2006        8                   60  
    2006        9                   150
    2006        10                 100
    2006        11                 200
    2006        12                  5Can this be done?
    Please advice
    Thanks

    Update:
    Try this blog from Shiva
    http://shivabizint.wordpress.com/2008/09/19/rolling-months-data-for-year-month-prompt-in-obiee/
    Edited by: MSK on Mar 10, 2011 1:07 PM

  • Solution: rolling sum, window function, window sum

    <p> </p><p>HowTo calculate the sum for the last 12 month:</p><p>---------------------------------------------------------------</p><p> </p><p>Account:</p><p> </p><p>    salesglobal                       -->sales values stored</p><p>    sales_accum                   -->sales_accum = @ACCUM(salesglobal) ;</p><p>    last_year                           -->last_year = @MDSHIFT(salesglobal, 1, year, );</p><p>    sales_last_12_month   -->  </p><p>        sales_last_12_month= sales_accum            </p><p>+@SHIFT(last_year,1)            </p><p>+@SHIFT(last_year,2)            </p><p>+@SHIFT(last_year,3)            </p><p>+@SHIFT(last_year,4)            </p><p>+@SHIFT(last_year,5)            </p><p>+@SHIFT(last_year,6)            </p><p>+@SHIFT(last_year,7)            </p><p>+@SHIFT(last_year,8)            </p><p>+@SHIFT(last_year,9)            </p><p>+@SHIFT(last_year,10)            </p><p>+@SHIFT(last_year,11)            </p><p>+@SHIFT(last_year,12);</p><p> </p><p>best regards</p><p>Klaus Kurz</p><p> </p><p> </p><p>There is even a better solution:</p><p> </p><p>         sales_last_12_month=</p><p>                    @sumrange(salesglobal,@ILSIBLINGS(@currmbr(Time))) +</p><p>                    @sumrange(last_year,@RSIBLINGS(@currmbr(Time))) ;</p>

    Elset, you were right .. I just need to connect the index of the for loop to the array subset to update the values and that was all ... sometimes you just keep giving turns around on a simple solution ..
    I am going to attach the solution if somebody have something different or see something wrong just let me know.
    Thanks ..  
    Attachments:
    sum_window.vi ‏50 KB

  • Rolling sum in OBIEE 11 g

    Hi All,
    I have data in my report like this.
    Month Sales rsum
    01 100 100
    02 200 300
    03 400 700
    05 500 500
    Month 04 doesnt have sales so it is not showing in the report that why the rsum is now 500 as it starts the new row with 05 only.
    The data should be like this.
    Month Sales rsum
    01 100 100
    02 200 300
    03 400 700
    05 500 1200
    any workaround for this.

    Hi Deepak,
    When i gave the example i forgot to add that i am showing the pivot chart in the report and showing the RSUM in Line Graph for 3 years..where i have year at the column and i have one dimension at the page section of the prompt.
    So i m just showing the line graph where i have RSUM at the Vertical axis...Month at the horizontal Axis.
    Sorry for the confusion

  • Rolling Month Sum required

    Hi ,
    I like to achieve a functionality using the RSUM or Timeseries function but any of this would not help .
    I have a report to show the sales for last 12 months in such a way that each month of that 12 months will show the sum up all sales for past 11 months + that month .
    My requirement is that standing on Month - Apr2009 I like to see the sales value sum from May2008 to Apr2009 ,whereas standing on May 2009 I would like to see the sum of sales for each month from June 2008 to May2009 (where each month sales is not rolling sum rather individual month total sales).While I am using TODATE function in OBIEE 10.1.3.4 version it is showing the sum from Jan 2009 to Apr2009 (like Month to date) but my intension is to show the aggregated value in single dervied column using any of the analytic function to calculate the past 11 months aggregated value + that months sales to be represent in a single metrics.
    The difficulty of achieving this by using MSUM is that it works on number of row to be displayed in report .Since I have a filter on date range from current date to currentdate-365 to show the relevant month in this range and to calculate the sum on basis of that.So using MSUM(Sales,12) for first month is not aggregating with past 11 months sales rather only showing that month sales data which is wrong .
    Any response to achieve this functionality would be helpful for us .
    Thanks in advance,
    D

    create an alias of the fact table in the physical layer
    join factalias to timedim in physical layer using complex join as
    TIMESTAMPADD( SQL_TSI_MONTH , -(12), Time.date) < fact.date and Time.date >= fact.date
    bring this aliasfact table table to logical layer in the same subject area, join to time dim (and othe dims) using a complex join.
    create necessary measures , such as 12monthsales
    move new table to presentation layer
    use this new 12monthsales columns in report
    so when you use time, it wont cut you off at the first month, but will go 12 month back for each month.
    hope this helps

  • Logical Columns - Running Sum & 3Month Rollover

    Hi All,
    Need to build a logical column.
    I have a column with number of units (count distinct) in RPD.
    I need to build a new logical column in the REPOSITORY , such that it has running sum values.... sothat when i pick this #units column and months column in the ANSWERS...I need to get roll over of all previous values for first month.
    Say Jan ---> XXXX units ( summation of all previous available units - few years)
    Feb----> YYYY units ( sum of till jan values & Feb units)
    Mar----> ZZZZ ...etc ( sum of till Feb values & Mar units) so on.
    Based on this newly built column I need to build another column of " 3 months roll over " column.
    Replies appreciated.
    Thanks in advance.

    Hi user11939829m
    So help me understand your new measures a little better. For the sake of this post, let's say your data is like so
    Month Year -- Units
    Jan 2010 -- 1
    Feb 2010 -- 2
    Mar 2010 -- 3
    Apr 2010 -- 4
    May 2010 -- 5
    Jun 2010 -- 6Then let's say you have a report with the above columns and the new running sum columns.
    Month Year -- Units -- Running Sum Units
    Jan 2010 -- 1 -- 1
    Feb 2010 -- 2 -- 3
    Mar 2010 -- 3 -- 6
    Apr 2010 -- 4 -- 10
    May 2010 -- 5 -- 15
    Jun 2010 -- 6 -- 21Now what exactly would your three months rollover be? Would the 3 month rolling sum = running sum for current month + running sum for last month + running sum for last last month?
    i.e.
    Month Year -- Units -- Running Sum Units -- 3 Month Rolling Sum
    Jan 2010 -- 1 -- 1 -- 1
    Feb 2010 -- 2 -- 3 -- 4
    Mar 2010 -- 3 -- 6 -- 10
    Apr 2010 -- 4 -- 10 -- 19
    May 2010 -- 5 -- 15 -- 31
    Jun 2010 -- 6 -- 21 -- 46Not sure what value such a measure would add. Or do you mean 3 month rolling sum would be the running sum for just the last three months (like below)? This makes more sense but in your description, you indicated that you'd build the 3 month rolling sum off of the running sum which confused me a bit.
    Month Year -- Units -- Running Sum Units -- 3 Month Rolling Sum
    Jan 2010 -- 1 -- 1 -- 1
    Feb 2010 -- 2 -- 3 -- 3
    Mar 2010 -- 3 -- 6 -- 6
    Apr 2010 -- 4 -- 10 -- 9
    May 2010 -- 5 -- 15 -- 12
    Jun 2010 -- 6 -- 21 -- 15 Is that what you are going for? Please elaborate.
    Best regards,
    -Joe

  • Rolling Months

    I created 12 rolling session variables to use to get 12 month rolling sums for my report. After creating the variables i made this filter to get sums for my GL balances (12 months ending).
    FILTER ("Facts - GL Balance"."Balance Amount") USING ("Time"."Fiscal Period End Date" BETWEEN VALUEOF(NQ_SESSION.PERIOD_START_11AGO) and VALUEOF(NQ_SESSION.PERIOD_END_00))
    this filter works only for 12 periods from the current date (NQ_SESSION.PERIOD_END_00) - how can I expand my range to include all the fiscal periods from 2002 to 2011, right now the report only gives me 12 periods from 10/31/2011 to 11/30/2010... for some reason my filter is limiting me, how can i circumvent this.... any help wld be apprceiated!!!!

    Thank you Deepak, you guided me correctly it is working for my 12/31 end of month dates bcoz it is rolling summed months from january. All other dates when selected from droplist are a sum from jan and not 12 months ago, i did all teh steps how can i now make the data correct- thanks
    Edited by: 846431 on Nov 2, 2011 9:21 AM

  • MDX code in XI 3.1 SP3 universes for time-related metrics

    Hi all,
    I have a multiprovider in BW 7.01 and I have installed BOE XI 3.1 SP3, integration kit and all.
    I need to calculate a metric (Sales Price) in this manner:
    after selecting a period (month/year), for a customer, in a sales centre (both customer and centre are optional conditions).
    I need to calculate these different values for the given metric:
    - value for the period and for the same period of previous year, plus difference between both values
    - accumulated value from january until selected period, same for previous year and difference between both values
    - rolling sum of 12 periods up to selected period, same for previous year and difference between both values
    And all of them according to different dimensions, such as geography, age, type, etc...
    For reasons of volume, abstraction capabilities, etc. we need to use a multiprovider.
    In your expert opinion, what would be the best approach for this?
    Would you edit the universe and create new objects using MDX functions, such as PERIODSTODATE, etc.? If so, have you ever tried it? could you suggest a syntax, taking into account we don't have the MDX wizard yet in 3.1 SP3?
    Is there some other approach that you've used, such as using formulas in Web Intelligence?
    Regards!
    David
    Edited by: David Perez on Jan 10, 2011 4:21 PM

    I found a workaround for the issue by patching and compiling the Axis2 kernel library. You need to download it form Apache, install Maven 2.0.7, set the default timeout in .../client/Options.java to a value that suits your needs (for me: 20min), and compile the whole thing using mvn clean install.
    But this is obviously not the solution one wants. So, is there anybody with a REAL answer to the problem?
    Regards,
    con

  • Please help me break down this code

    i really need help at understanding this, i put it together a while ago with some help but im really no pro at java but my tutor has asked me to give a break down of the code line by line
    /*  This program rolls two six-sided dice a user-specified
    number of times, and prints how many times an ordered dice combination occured.
    This is followed by a column stating how many times the sum of the two dice
    equalled 2 through 12.
    import java.util.Scanner;
    public class DiceSumDistribution
         public static void main(String[] args)
              Scanner scan = new Scanner(System.in); //receive input from keyboard
              System.out.print("Enter the number of times you would like to toss two dice: "); //prompt user for input
              int timesToToss = scan.nextInt(); //read in user input
              int[] diceSum = new int[37]; //this array holds the dice roll distribution table
              int[] frequencySum = new int[13]; //this array holds how many times a dice sum occured
              int die1, die2; //integers representing the two dice
              for(int i = 0; i < timesToToss; i++) //toss two dice as many times as the user specified
                   die1 = (int) (Math.random()*6+1); //assign random number (1 through 6) to dice one
                   die2 = (int) (Math.random()*6+1); //assign random number (1 through 6) to dice two
                   diceSum[(6*(die1-1))+die2]++; //add one to appropriate cell in distribution table
                   frequencySum[die1+die2]++; //add one to appropriate sum counter
              /*the dice roll distribution table shows how many times a certain combination of dice rolls
                      and the rows represent the other dice.
              System.out.println("\n---Dice Roll Distribution Table---");
              System.out.println("\t 1\t2\t3\t4\t5\t6"); //print distribution table
              System.out.println("\t____________________________________________"); //print distribution table
              for(int i = 1; i < 37; i++) //print all 36 cells of distribution tables
                   if(i%6 == 1) //if at the beginning of a table row
                        System.out.print(i/6+1 + "\t|"); //print row number
                   System.out.print(diceSum[i]+ "\t"); //for each cell in a row, print its value
                   if(i%6 == 0) //if at the end of a row
                        System.out.println(); //go down a line
              /*this column represents how many times a sum occured. For example, if the following output occurs
              System.out.println("\n---Dice Roll Sums---");
              for(int i=2; i<=12; i++) //for each possible dice sum
                   System.out.println(i+": " + frequencySum); //print each dice sum on its own row
    ii wrote this with some help a while ago but i havent done java at all since so im totaly clueless again. if someone could help i would be really greatful, thanks.

    ok chill man, and i wasnt asking you to do it for me or nothign liek that.
    its mostly these parts im having trouble explaining
    Scanner scan = new Scanner(System.in); //receive input from keyboard
              System.out.print("Enter the number of times you would like to toss two dice: "); //prompt user for input
              int timesToToss = scan.nextInt(); //read in user input
    die1 = (int) (Math.random()*6+1); //assign random number (1 through 6) to dice one
                   die2 = (int) (Math.random()*6+1); //assign random number (1 through 6) to dice two
                   diceSum[(6*(die1-1))+die2]++; //add one to appropriate cell in distribution table
                   frequencySum[die1+die2]++; //add one to appropriate sum counter
                   if(i%6 == 1) //if at the beginning of a table row
                        System.out.print(i/6+1 + "\t|"); //print row number
                   System.out.print(diceSum[i]+ "\t"); //for each cell in a row, print its value
                   if(i%6 == 0) //if at the end of a row
                        System.out.println(); //go down a linei know in the last one there the "if(i%6 == 1) " and "if(i%6 == 0) " effect the
    "System.out.print(i/6+1 + "\t|");" in some way, but i dont really know how to explain it.
    thanks

  • CALCULATE RUNNING TOTALS FOR SUBSETS OF THE DATA IN A SECTION

    How can I calculate a running total in BO XI Release 2, (WebI), where my totals only include the value of the current row and the previous 5 rows?
    For Example:
            In the data, behind my BO table, I have transaction dates that roll up to a dimension called Period.  The "Period" represents the Year and Month of the transaction date, which is a month's worth of data at a time.  Each month contains an aggregated value that is the Population of items for that month.  The RunningSum function in BO works well, except that I need the running total to only include the current month along with the last 5 months, for a total of 6 months worth of data per row. 
            See my example below.  The Period of JAN 2009 includes the Population for JAN 2009 plus the sum of the Populations from AUG 2008 through DEC 2008 for a total of 6 months worth of data.  FEB 2009 includes SEP 2008 through FEB 2009.  MAR 2009 includes OCT 2008 through MAR 2009...
    __________Period_______Population_______6 MOS
    __________200801__________54___________54
    __________200802__________60__________114
    __________200803__________50__________164
    __________200804__________61__________225
    __________200805__________65__________290
    __________200806__________58__________348
    __________200807__________70__________364
    __________200808__________64__________368
    __________200809__________59__________377
    __________200810__________62__________378
    __________200811__________66__________379
    __________200812__________75__________396
    __________200901__________62__________388
    __________200902__________53__________377
    __________200903__________63__________381
    __________200904__________67__________386
    Six months is obviously no magic number.  I'd like the solution to be flexible enough to use for 3, 12, 18, or 24 month periods as well.

    Hi Frank,
    can you consider building the rolling sums directly in your database using subselects in the select statement:
    eg. select attr1, attr2,key2, (select sum(key1) from B where B.month<=A.month and B.month>=A.month-6) from A
    Just create a key figure in your universe and add the subselect statement select sum(key1) from B where B.month<=A.month and B.month>=A.month-6 as select-clause.
    ATTENTION: This is SQL pseudo code.
    Regards,
    Stratos

  • Rolling averages/sums for counts

    I am a new user (business objects 12 relaease 2)
    I would like to build a report in web intelligence displaying the average count of the number of records per day, where the average is calculated for a rolling window of days.
    For example a rolling daily average count of records using a 3 day window would be caluculated by:
    Summing the counts of records for the last three days and dividing by 3
    I would like to include this rolling average in a table for a specified of time period, say the last 30 days. My table would have two rows the top row would be the date and would hgave 30 entries, inbe for each of  the previous 30 days, The scond row would have the 3 day rolling average for each of the 30 days. This table format will also allow me to graph the table
    An additional problem arises becasue there are some dates that have no data. I need to include those dates, but Web Intelligence won't display them. Is there a way of displaying dates with no values in the table?

    John Berezowski,
    In response to your question: "An additional problem arises becasue there are some dates that have no data. I need to include those dates, but Web Intelligence won't display them. Is there a way of displaying dates with no values in the table?"
    The solution is to build a "backend table" in your data base that has all of the applicable dates accounted for.  Then modify your universe by linking this new table to your pre-existing table and process as a left outer join (providing that this new table is on the "left" side, otherwise a full outer join will suffice due to the manner that you've built your table).
    A technique you can apply to the other columns used in your original table would be the use of the "coalesce" function to avoid nulls and transform unjoined values to spaces (or zero or some other value for integers). 
    thanks,
    John

Maybe you are looking for