Calculate Four Week Average SellThru In RPD

Hello All,
We have a requirement to calculate the four week average sellthru dynamically in OBIEE. Basically we need to expose SellThru Average as a column in presentation layer. The calculation of this column should use the below logic. Also see below for data model details too.
1. The SellThru Average is dependent on another metric called SellThru
2. The data in fact table is at a grain of Item and Customer. These two are confirmed dimensions.
3. Rules to calculate the SellThru Average
a. If the customer is looking at the Week10 data at item level, the average should be calculated using Week5, Week6, Week7 and Week8 SellThru.
b. If the SellThru is available for all the above weeks, then the formula for average will be (Week5 SellThru+Week6 SellThru+Week7 SellThru+Week8 SellThru)/4
c. If the SellThru is not available for Week5, then we need to go back and see if SellThru data is available with in last 26 weeks for that Item. If yes then the denominator will be 4 and numerator stays the same
d. If the SellThru is not available with in last 26 weeks, and only available for Week6, Week7, Week8 then the formula would be (Week6 SellThru+Week7 SellThru+Week8 SellThru)/3
e. If the SellThru is not available with in last 26 weeks, and only available for Week7, Week8 then the formula would be (Week7 SellThru+Week8 SellThru)/2
f. If the SellThru is not available with in last 26 weeks, and only available for Week8 then the formula would be (Week8 SellThru)
g. If the SellThru is not available with in last 26 weeks, and only available for Week5 then the formula would be (Week5 SellThru+Week6 SellThru+Week7 SellThru+Week8 SellThru)/4.
In all the above cases, for whichever week the SellThru is not available, substitute with 0
These rules needs to be applied at all the higher levels for both Item and Customer dimensions. For example, if the user is looking at Segment level which is the next level to item in Product hierarchy we need to check if the SellThru is available for any of the item under that segment for the respective weeks and apply one of the above formula accordingly.
We were able to achieve this using OBIEE logical columns and repository variable for Current Week alone. But we are stuck at calculating the averages for previous weeks. Meaning, if the user is viewing the data for Previous week, we need to go back from that week. It's basically dynamic in nature. User can also look at two or more weeks data at the same time and the average needs to be displayed as per that.
I hope i have explained the requirement OK. Any help in this will be well appreciated. Thanks in advance.
Siva

Hi Thomas,
  Create a selection in which you will key figure KF3 and a calweek with restriction with fromcalweek and to calweek variables.
The tocalweek is a formula variable which is derived from replacement path of characteristic calweek.
and fromcalweek is offset of tocalweek variable - 6.
So for each week it put toweek as that weekno and fromweek as weekno - 6 and brings the KF3 value in that range.
Regards
vamsi

Similar Messages

  • Calculate result as average in the report not showing average for all

    Hello,
    I have a calculated key figure in the query where its result should show average. I have made a setting for this calculated key figure as:
    1. Calculations tab: Calculate result as "average" and calculate single value as "nothing defined"
    2. Aggreagation tab: exception aggregation: Total and reference char: []
    Now coming to report, BEX it showing correct average for all cells but when i run it in portal few values it is showing correct average but for few it is showing as blank. I exported this to excel then cell shows blank but cell has some values in the custom format and display values when i change the format to general from "format cells" option.
    Please help me in resolving the issue- why portal not showing value for all.
    Thanks,
    Vijaya

    SAP note solved the purpose.
    Thanks & Regards,
    Vijaya

  • How to calculate the weeks in one month

    Dear Freinds,
                   I have one requirement where i have to get no of weeks in a week . The requirement is
    if in a particular month from the start of the month i have to have 8 days in a week.
    lets for example in the month of novemeber 2008 (Four Weeks) ,  iwant the data as below
    from 1st nov + 8 thnov -
    will give first week 
    from 9thnov + 16thnov -
    will give second week 
    from 17th nov + 24thnov -
    will give third week  
    from 25th nov +30th -
    will give fourth week  .
    could any one plese help me out how i can trace the above functionality through my code  how i can
    acheive the dates  1st nov to 8th as first week  and 9thnov + 16thnov  as second week.
    could you please help me in this regard .
    regards
    madhuri

    Hi Madhuri,
    If my understanding of your requirement is correct.  Please find the syntax below.
    Data : Result type i.
    Result = sy-datum+6(2) MOD 7. (or)
    Result = date+6(2) MOD 7.
    Let me know if your requirement is different.
    Award points if you find the answer helpful.
    Regards,
    Gowri

  • Why does the callender not have a four weekly?

    Why does the apple calendar not have a four weekly. This would be a great help.

    This is on the I pad. I don't have a mac, only a pc.

  • Change Calendar month view from six weeks to four weeks

    Hi - this may not be be possible, but I thought I'd ask the community.
    I prefer working with the Calendar in month view. Mavericks always dispays six weeks in month view, while Mountian Lion would display four, five, or six weeks, depending on the month. On my Macbook Pro 13", the new six week view creates days that are too small to work with.
    Is there any hidden preference that could make it display just four weeks at a time, rather than six?
    Thanks.
    Steve

    Thanks for the wild and crazy ideas.
    I did remove any events that span midnight and it did not help.
    I looked at the DbFixit program. Since it corrects problems in the Palm and not in Palm Desktop I believe it is not relevant. The reason I belive the palm device is not involved is because of the following test:
    I removed all previous Palm Desktop versions
    I removed all registery entries for both Palm, PalmOne, and the USB (as specified by a chat session with Palm)
    I removed all data directories including \Program Files\PalmOne, \Program Files\Palm, and \Palm
    I removed all instances of data in the Documents directory
    I did a cold boot of the computer
    then...
    I did a fresh install of Palm Desktop
    I typed in a year's worth of data
    I did not sync or otherwise connect a palm to the system
    I selected month view
    The system crashed!
    I believe this takes the Palm device completely out of the loop. This problem occurs when typing data in Palm Desktop from the keyboard.
    I appreciate any ideas, and will follow up on them.
    Thanks again
    Jack Cornelius
    Since no Palm was involved, the corruption must have occured in the Palm Desktop program itself.
    Post relates to: Tungsten E2

  • How to create a customer-exit to calculate a week from a date

    Hi my Guru's,
    I actually try to implement an Exit variable to calculate a week number from a characteristic date (0FINISHDATE) in my BEX report. Does anyone has an example of customer-exit which calculate a week number after giving a date in the popup.
    What I really need is how to initialize the OFINISHDATE value in my Exit.
    Any help will be appreciate,
    Cheers,
    MK2

    Hi,
    I  donot know this following workaround works properly are not. we have to wait for Our BW gurus' suggestions.
    1) Create a formula variable with 'Replacement path' as processing type on Characterstic 0FINISHDATE.
    2) Create one more Formula variable with 'customer exit' as processing type .
    3) In Cmod
    DATA: l_s_range type rsr_s_rangesid.
    DATA: datein like sy-datum. "la caractéristique date
    DATA: date2 like SCAL-WEEK. " déclaration de Résultat
    DATA : NUMB1(2) TYPE N.
    CASE i_vnam.
    when 'FORMULA_VARIABLE2'.
    IF I_STEP = 2. "after the popup
    LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
    WHERE VNAM = 'FORMULA_VARIABLE1'.
    CLEAR L_S_RANGE.
    L_S_RANGE-LOW(8) = LOC_VAR_RANGE-LOW(8)
    datein(8)  = L_S_RANGE-LOW(8).
    here we are finding the Week no user entered date.
    CALL FUNCTION 'DATE_GET_WEEK'
    EXPORTING
    DATE = datein
    IMPORTING
    WEEK = date2.
    numb1 = date2+4(2)
    CLEAR L_S_RANGE.
    L_S_RANGE-LOW  = numb1.
    L_S_RANGE-SIGN = 'I'.
    L_S_RANGE-OPT  = 'EQ'.
    APPEND L_S_RANGE TO E_T_RANGE.
    ENDCASE.
    With rgds,
    Anil Kumar Sharma .P
    Message was edited by: Anil Kumar Sharma

  • BI Routnie in DTP to calculate current week from current date

    Hello Team
    I want to write routinue to calculate current week based on date
    For eg, this week is
    201410, so the routine will get 201410 based on today’s date 4 Mar 2014.
    Can any1 please help
    Regards,
    Ankit

    I had written following code its giving error like
    E:Field "/BI0/9AVERSION" is unknown. It is neither in one of the
    specified tables nor defined by a "DATA" statement. "DATA" statement.
      data: l_idx like sy-tabix.
      read table l_t_range with key
           fieldname = '/BI0/9AVERSION '.
      l_idx = sy-tabix.
    Data: Date Like scal-date.
    Data: week like scal-week.
    call function 'DATE_GET_WEEK'
    exporting
    date = sy-datum
    importing
    week = SOURCE_FIELDS-/BI0/9AVERSION
    exceptions
    date_invalid = 1
    others = 2.
    * Return code <> 0 means skip whole data package !!!
    returncode = 0.

  • My iPad2 is four weeks old and the home button will not always close the applicaton that is currently running

    My iPad2 is four weeks old and the home button will not always close the application it is currently running and the problem is getting worse and I have tried to restore the iPad but this did not improve the problem...Is this a hardware problem that I need to seek a replacement

    Your home button and power button are completely unresponsive, even when you attempt a hard reset? If so you will have to put into recovery mode and restore through itunes or possibly DFU if that does not work

  • How to show revenue last four weeks?

    Dear colleagues,
    I have a report demand in BO where I am supposed to show revenue for the last four weeks. The input data is a date, f.eks 19th of may. Since 19th of May is week 28, I want to see 27, 26, 25 and 24. How can I make this formula? Is it a BODI job?
    Hope you can help, will sign points!
    Regards Silje

    Hi Silje,
    Very similar to your YTD question...
    Again, this is normally solved in designer, hence the coding John gave you.
    However in stead of doing it in a condition, like he described, i would rather do it in a sum(case...end) variant. So create multiple measure objects. That way you can select in one query ytd, full year last year, last period, last 4 weeks, etc. Using a condition would force you to create multiple queries.
    so oracle syntax and using sysdate i.s.o. a prompted date as a bonus;
    weeks start on monday this way...
    sum(case when tab.datecolumn between sysdate-to_number(to_char(sysdate,'d'))+1 /* this monday */
    and sysdate-to_number(to_char(sysdate,'d'))+1-28 /* monday four weeks b4 that */
    then tab.amount end
    Hope this helps,
    Marianne

  • Calculate total and average for same key figure

    Hi Experts,
    I have a requirement where I need to calculate total and average for same key figure no of employees.
    eg:                
    If I enter 03,2009 as Input the reuslt should give from financiual year starting to current month.
         11.2008      12.2008     1.2009     2.2009     3.2009        average
             11          10       12       10        10         10.6
             10         10       11       12        10         10.6
    total         21         20       23       22        20          21.2
    we have only one characteristic in rows... companycode.
    Waiting for your Inputs.
    Regards
    Prasad Nannuri

    no it will work for u
    you have to use variable on 0calmonth or fiscal period depending on what Time characteristic u are using.
    lets say that variable is zcalmonth
    it is based on 0calmonth for e.g.
    now u restrict keyfigure with this variable zcalmonth with time char. = 0CALMONTH
    copy and paste the restricted keyfigure
    now set offset for variable in  variable selection screen dialog box = -1
    repeat this until u want
    make this variable mandatory
    now at query execution user will select any value for month/year
    and u will see all 5 months in result set
    now there can be maximum 12 months in a year, so u end up creating only 12 restricted keyfigures.
    use YEAR in restricted keyfigure too, and restrict it with YEAR VARIABLE processing by CUSTOMER EXIT = CURRENT YEAR
    in this case it will automatically removes any additional values...
    for e.e.g
    YEAR = 2008 only
    User entered 6/2008
    so lets say ur financial year starts in  april 2007 and ends in april 2008
    so u expect to see
    4/08
    5/08
    6/08
    but u created 12 restricted keyfigures , so it will show upto
    4,5,6 months only

  • Calculating weekly average in reports

    I have a report that looks like:
    Vol previous 7 day average
    12
    34
    45
    56
    34
    98
    12 41.6
    45 46.2
    76 52.3
    89 etc...
    12
    What would be the best way to do the previous 7 day average values in Reports 3.0.
    Thanks for any assistance.
    null

    I have a table like this:
    ViewID
    ViewDateTime
    I would like to have the weekly average of views and
    have an output that looks like:
    [Weekly Avg] [Week Starting]
    Any help would be greatly appriciated.If I have well understood, then this will help you: (format is the format of your choice)
    SELECT Avg(ViewID) "weekly Avg",
           TO_CHAR(TRUNC(MIN(ViewDateTime), 'WW') + 1, 'format')
    FROM t
    GROUP BY TO_CHAR(ViewDateTime, 'YYYY') || TO_CHAR(ViewDateTime, 'WW')I began editing before your explanation so you can suppress the year if all your records are in the same one.
    Message was edited by:
    Michel

  • Regarding Customer exit to calculate fiscal week

    Hello All,
                 I have a requirement to calculate the fiscal week from fiscal period. Here i used the FM 'UMC_FISCPER_TO_CALWEEK' to calculate the fiscal week. But the problem here is i created variable on fiscal year /week so when i pass the fiscal period i should get fiscal week, here i am getting calweek which make no sence. Is there any function module to calculate the Fiscal week if we pass fiscal period.
    Thanx in Advance
    Anil

    We cant calculate fiscal week from just fiscal period. we need date or this.
    You can try this function  ZFI_GET_FISCAL_WEEK_QUARTER or some other similar function. However, the input should be a date.
    Looks like there is no funciton to calculate fiscal week. we may need to write our own code for this based on other FMs.
    Re: Get Week number in a particular Fiscal year
    ~ Arun KK
    Edited by: arun kk on May 8, 2008 10:22 AM

  • Calculate Results As Average of Detailed Values That Are Not Zero... with hiearchies doesn't work

    Hi all,
    For the key figures, the option of "Calculate Results As Average of Detailed Values That Are Not Zero, Null, or Error" works fine for characteristics drilldown without hierarchies, but with hierarchies it simply doesn't work; instead of calculate the overall result as average, the system calculates it as SUM. It works like the option "Nothing Defined" where the results provided by the analytic engine are displayed. No local calculation takes place.
    How can I do to display the overall result of hierarchical drilldown of a characteristic as an average?
    Many thanks in advance!
    Abraham

    It is usually best to just keep it as simple as possible.  What do you think the code in the OR Array Elements does?  I imagine it is just a simple FOR loop with a variable to keep the latest OR.  So I would do what GerdW just showed with the FOR loop.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How to calculate the weighted Average

    Hi,
    How can i calculate the weighted average in BO Webi ??
    Thanks,
    Siva

    Siva,
    Depends on what type of weighted average you want to calculate, but it will be something like:
    =([x1] * [x2]) / Sum([x1]) in Report
    Cheers,
    Harry

  • Can i set calendar events to four weekly?

    Can I set calendar events to four weekly rather than monthly or fortnightly?

    in iCal double click the new entry after you make it, and it will pop up a new window where you can edit furhter settings like the alert and repeat settings.
    just choose 'repeat' and then custom, you can then choose any configuration of days ,  weeks etc, and on what day if you choose weekely, for example 'every 3 weeks on a wednesday'

Maybe you are looking for