Yearly average calculation

Hi,
It may sound like trivial but I can't find the way to compute a yearly average considering only on the months that have data.
Considering the fact that I need to store this yearly average, I have to use a script logic.
Here is what I have tried but to no avail:
*CALC_EACH_PERIOD
*WHEN ACCOUNT  
     *IS #INCOMETAXPERCCUM
          *REC(TIME=NEXT)
     *IS #COUNT
          *REC(TIME=NEXT)
     *IS INCOMETAXPERC
          *REC(EXPRESSION=1,ACCOUNT=#COUNT,TIME=NEXT)
          *REC(ACCOUNT=#INCOMETAXPERCCUM,TIME=NEXT)
     *REC(EXPRESSION=(%VALUE%GET(ACCOUNT=#INCOMETAXPERCCUM))/(1GET(ACCOUNT=#COUNT)),CATEGORY="%CATEGORY_SET%", TIME="OPE.PLAN")
*ENDWHEN
When I check the debug log, I notice that the two temporary variables #INCOMETAXPERCCUM and #COUNT are only computed for the first member that is included in my ENTITY memberset but not for the others. Besides, it does not cumulate as I would expect it would.
Any idea what I am doing wrong?
Thanks in advance,
Regis

Hi Nilanjan,
I need to compute a yearly average of an income tax percentage that is captured at monthly level. The result goes onto a special time period member called OPE.PLAN
My time dimension looks like this:
2008.TOTAL
     2008.Q1
          2008.JAN
          2008.FEB
PLAN.TOTAL
     PLAN.Q
          PLAN.OPE
          PLAN.2011
          PLAN.2012
          PLAN.2013
We are building a long-term plan which projects a reference year (2008 in this case) to 25+ years. We "annualize" all accounts and assumption drivers such as income tax rate... on this period PLAN.OPE which becomes the period of reference when projecting.
The issue is that the income tax rate may not have been input on each month of 2008. So when we calculate the yearly average, we should basically divide the sum of all income tax rates for months that have an income tax rate divided by the number of months that have an income tax rate.
Example:
2008.JAN     2008.FEB     2008.MAR     2008.APR     2008.MAY     2008.JUN...     2008.DEC
15%               15%               15%                                             12%               12%
Assume that the income tax rate from 2008.JUN to 2008.DEC is 12%. There is no income tax rate on 2008.APR and 2008.MAY
So when I compute the yearly average of income tax rate I should do this: (15151512...+12)/10
Does it make sense?
Thanks,
Regis

Similar Messages

  • How can I activate the average calculation with cl_salv_hierseq_table class

    Hi there,
    Iu2019m using class cl_salv_hierseq_table to display a two level hierarchy (header and item) list.
    For some reason it seams that those calculations are active by default with class cl_salv_table but not for cl_salv_hierseq_table.
    I tried every suggestion from the class documentation and SAP help and nothing seams to work, the menu calculation options are always inactive except for the total calculation.
    After the cl_salv_hierseq_table=>factory...
    And before cl_salv_hierseq_table->display( )
    I triedu2026u2026.
    cl_salv_aggregations = cl_salv_hierseq_table->get_aggregations( 1 )
    cl_salv_aggregations->add_aggregation( 'COLUMN1' )
    COLUMN1 is a currency column in header level table
    u2026u2026..
    cl_salv_aggregations = cl_salv_hierseq_table->get_aggregations( 2 )
    cl_salv_aggregations->add_aggregation( 'COLUMN2' )
    COLUMN2 is a dec column in item level table
    u2026u2026..
    cl_salv_aggregations = cl_salv_hierseq_table->get_aggregations( 2 )
    cl_salv_aggregations->add_aggregation( columnname = 'COLUMN2' aggregation = if_salv_c_aggregation=>average )
    u2026u2026..
    cl_salv_aggregations = cl_salv_hierseq_table->get_aggregations( 2 )
    cl_salv_aggregations->set_aggregation_allowed( 'COLUMN2' )
    u2026u2026..
    cl_salv_aggregations = cl_salv_hierseq_table->get_aggregations( 2 )
    cl_salv_aggregations->set_numerical_aggregation( ).
    cl_salv_aggregations->set_aggregation_allowed( 'COLUMN2' )
    cl_salv_aggregations->add_aggregation( columnname = 'COLUMN2' aggregation = if_salv_c_aggregation=>average )
    u2026u2026..
    cl_salv_aggregations = cl_salv_hierseq_table->get_aggregations( 2 )
    cl_salv_aggregations->add_aggregation( 'COLUMN2' )
    cl_salv_aggregation = cl_salv_aggregations->get_aggregation( 'COLUMN2' )
    cl_salv_aggregation->set( if_salv_c_aggregation=>average )
    Any help will be appreciated!

    Thanks Harsh Bhalla,
    Subtotals can be built (displayed) at Header Level Only, true but the values to calculate those totals can come from either header or item level, otherwise it wouldnu2019t be of much use would it?
    Anyway my question is how to activate the average calculation as well because the totals calculations is already active for either item or header level by default.
    For reference when on the display layout Iu2019m referring to the menu Edit -> Calculate -> Mean Value.

  • Last year sales calculation in calculated column

    Hi everybody!
    Please help me to solve issue with last year sales calculation in calculated column. I have 'Fact' table with sales for every period in it and related table 'Time' with 1, 2, 3 'PeriodID' column for string MAT 2011, MAT 2012, MAT 2013.
    I know the solution for measure:
    =CALCULATE ( SUM(Fact[Sales]); FILTER (ALL ('Time'); 'Time'[PeriodID] = MAX(Time[PeriodID]) - 1))
    But for the purpose of my analysis I need to make a calculated column. What I want to see looks like this table:
    Product
    Period
    Sales
    SalesLY
    A
    MAT 2013
    17
    10
    B
    MAT 2013
    20
    23
    C
    MAT 2013
    45
    33
    D
    MAT 2013
    13
    16
    A
    MAT 2012
    10
    8
    B
    MAT 2012
    23
    31
    C
    MAT 2012
    33
    5
    D
    MAT 2012
    16
    22
    A
    MAT 2011
    8
    0
    B
    MAT 2011
    31
    0
    C
    MAT 2011
    5
    0
    D
    MAT 2011
    22
    0

    Thanks for the idea!
    It's an option. I slightly modified expression to make it more generic:
    =CALCULATE
          SUM (Fact[Sales]);
          FILTER (
                        Fact; Fact[Product] = EARLIER (Fact[Product]) && Fact[PeriodID] = (EARLIER(Fact[PeriodID]) -1)
    Where Fact[PeriodID] is calculated column with '=RELATED (Time[PeriodID])' formula. To my opinion this is more universal approach.
    But it has the cons. EARLIER is memory demanded function. In case of 32-bit OS or numerous nested EARLIER error might occur.
    Is there any alternative solution?

  • Bug average calculation in form?

    Hye,
    I made an editable form in acrobat XI for mac.
    I set all the fields to number and the last field I want to calculate the average of all the other fields.
    So I select the fields which average I want...
    But upon testing, I'm getting impossible average calculations.
    F.ex. testing several fields with value "9", returns me a "0,..." value, which is impossible...
    How to solve?
    Thanks

    It's hard to say what's happening without seeing a sample. Can you post one somewhere? Unfortunately, you can't post one here, but can at Acrobat.com, dropbox, skydrive.com, etc.

  • Average Calculation

    Hi,
    I am finding some problem while doing the Average Calculation in the Query.
    My data is like this:
    Batch      Stock       PO Qty          STO Qty
    B1           1000         1000               200
    B1           1000         1000               500
    In the output I want:
    Batch      Allocated           Unallocated
    B1           700                    300
    The calculation for Unallocated is ( Stock - Allocated ).
    Right now I am getting:
    Batch      Allocated           Unallocated
    B1           700                   1300
    What I want is to do the Average of the Stock Qty and then subtract that from the Allocatde Qty.
    Can anyone help out?
    Regards,
    Soumen

    Hi,
    You can use the Calculated key figure (if you need top 10)...
    Regards
    sathis

  • Urgent!!Average calculation based on a characteristic!

    Hi guys
      I have an average calculation based on a characteritic ..
    Example:
       This is a SRM Mgmt.It has an Organisation purchasing org,source purchase,PR,etc..
    Report is a Survey rpt.
    Average Score across Customer responded for each question for the particular PR...
    Where weightage is applied for each question & based on which
                            total weightage of all Qns for a PR
      Avg.Score=     -
                                No of Questions.
    How do u calculate using the exception aggregation??????????Pls revert ASAP.
    thnx
    BI Learner

    Solving Myself

  • Add average calculation to FBL5N?

    Hi,
    My user requires an average calculation on one of the columns in FBL5N (customer line items).  This is a standard transaction which uses an ALV.
    I know that I can add new fields into this transaction using customizing but I need an average, so would need to create a new field and populate it with strange looking numbers in order to get an average total at the bottom.
    I have seen an average calculation button on some ALVs and was wondering if it's possible to change the ALV settings in the code of FBL5N in order to get this to show?  At the moment I can only total and subtotal, there is no average calculation button showing.
    Or, if you can think of another solution, any suggestions gratefully received.  The last resort is asking the user to download the data to excel and calculate the average there.
    Thanks,
    Gill

    hi
    select the column,  which u have to calculate the average .
    and select edit menu ->calculate->Mean value
    regards
    surender

  • Average calculation Problem

    how can i apply the average calculation on a varchar column means only average the number values in that column and leave or return null if any character value comes in average
    thanks

    Hi,
    Below is a conversion function, like Justin suggested.
    Using this will be slower than a pure-SQL solution, so if Ankur's sulution works for you, you may want to stick with that.
    CREATE OR REPLACE FUNCTION     to_num
    (     in_txt          IN     VARCHAR2
    ,     in_non_num_val     IN     NUMBER     DEFAULT NULL
    RETURN     NUMBER
    DETERMINISTIC
    IS
    --     to_num attempts to convert in_txt into a number.  If it can,
    --     then the value is returned.  If in_txt cannot be interpreted
    --     as a number for any reason (e.g., it contains letters) then
    --     in_non_num_val is returned.
    --     to_num (NULL) returns NULL.
    BEGIN
         RETURN     TO_NUMBER (in_txt);
    EXCEPTION
         WHEN     OTHERS
         THEN
              RETURN     in_non_num_val;
    END     to_num;
    SHOW ERRORS

  • Average calculation with joins

    Hi all,
    Please have a look here.,
    Re: average calculation using sql
    My Question is :
    Is it possible to do a join here,
    so that in where condition thistable.id=newtable.id
    and in column area i need projects from new table.
    i.e.,
    Projects Name Remark SUM AVG
    I tried with this query..
    SELECT Projects,Name,Remark, SUM(work_hrs), AVG(work_hrs) FROM (
    SELECT name,remark ,a.id,b.id,start_dt,end_dt,SUM(end_dt-start_dt) OVER (PARTITI
    N BY name,remark ORDER by Name) work_hrs
    FROM T a,T1 b) where a.id=b.id
    GROUP BY ROLLUP(name,remark);
    But o/p is not as i expect..
    Thanks in advance...

    The alias 'b' does not exist outside of the subquery/inine view. Try to alias your subquery for clarity then refer to it;
    SELECT MAX(sub.sr_pm_name), sub.ts_desc, sub.ts_remarks, AVG(sub.work_hrs)
    FROM (SELECT ts_desc,
                 ts_remarks,
                 b.sr_id,
                 a.ts_srid,
                 b.sr_pm_name,
                 ts_expected_date,
                 ts_actual_date,
                 SUM(ts_actual_date - ts_expected_date) over(PARTITION BY ts_desc, ts_remarks ORDER BY ts_desc) work_hrs
          FROM t_status_report b, t_task_status a
          WHERE b.sr_id = a.ts_srid) sub
    GROUP BY ROLLUP(ts_desc,
                    ts_remarks);Another way that might be easier to follow is to use the WITH clause;
    WITH sub AS (
       SELECT ts_desc,
              ts_remarks,
              b.sr_id,
              a.ts_srid,
              b.sr_pm_name,
              ts_expected_date,
              ts_actual_date,
              SUM(ts_actual_date - ts_expected_date) over(PARTITION BY ts_desc, ts_remarks ORDER BY ts_desc) work_hrs
       FROM t_status_report b, t_task_status a
       WHERE b.sr_id = a.ts_srid)
    SELECT MAX(sr_pm_name), ts_desc, ts_remarks, AVG(work_hrs)
    FROM sub
    GROUP BY ROLLUP(ts_desc,
                    ts_remarks);

  • Movign Average Calculation

    hoe the moving average calcualte?
    i got one case. the client return the goods at the date that material stock is zero.
    will this influnce to the MB03?

    Hi Lucas
    The calculation is as below when Goods receipt for PO
    Balance on hand quantity + Goods Receipts quantity
    Balance on hand value     + Goods Receipts value
    New Moving Average Price = Total Value / Total Quantity
    Asha

  • Weighted average calculation in query

    Hello
    i'm having some issues calculating an weighted average...
    imagine the next scenario
    LINE | FORMAT | TIME | WORKERS
    10    | 000123    | 10   | 5
    10    | 000123    | 350  | 2
    10    | 000123    | 75   | 1
    From this i need the wighted average of the nr workers considering the time they were working
    so, to calculate that i have to do for example:
    (time * worker)/total time
    in numbers...
    ((105)+(3502)(75*1))/(10350+75)
    =1,89 workers for that line, for that format and for all that time
    I am able to do that formula inside bex analyser, however when the user drills down the report or sorts the key figures in other order the result is not correct.
    any suggestions?
    Best regards

    Hi Ricardo
    What we did, in a similar case, we used two formulas. The first one was the calculation (time * worker) with exception aggregation (summation).
    The second formula was the previous formula divided to time.
    The trick is which characteristic to use for the aggregation in the first formula, i think you should have the most detailed one.
    Then i believe the two formulas will calculate correctly the weighted average based on any selections/analysis that you do.
    Regards
    Yiannis

  • Average Calculation for Available Data only

    Hello Gurus,
    I have a requirement where I have to calculate Daily average based on Hours (24 hours). We get one reading for every hour. SO 24 readings and divide them by 24. It works fine when I do a calculation like ([Measure]/24) as Hours would always be constant.
    The problem comes when we miss some readings for few hours. In that scenario User do not want to take those hours into consideration for which reading is missing.
    How can I achieve that?
    Any suggestions?
    Regards
    Shalini

    Hi,
    Try this formula.
    =sum([Measure])/count([Measure]) where ([Measure]>0)
    or
    =sum([Measure])/count(sum([Measure]) where ([Measure]>0))
    Amit

  • Field average calculation

    I am designing an Employee Review form and in that form I have a field that calculates the average of a set number of other fields. The problem is that the users can enter 1-5 or n, where n = no experience. I want the average field to only average the fields with 1-5 in them and skip the n fields. I have tried multiple ways of acomplishing this, but none have worked. Really could use some help on this one!!

    Have you tried a "Custom Calculation Script"?
    A custom calculation script will required the use of specific field names to be processed.
    Unless you are computing the average on all items you might consider using a function for counting and summing the fields and values in a range of questions.
    Since it is possible that no questions could be answered, you need to allow for a count of zero items being used for the computation.

  • Hyperion Strategic Finance - Formula for last years average

    Hi all,
    I am starting developing a model in HSF.
    At first glance the tool is perfect for our needs but unfortunately I get stuck sometimes with the formulas.
    I am trying to show last year's average on a forecast account.
    The problem is that apparently I cannot blend relative (-1Y) and absolute (@since(Jan)) parameters.
    Does anyone of you know how to do this?
    Your help is much appreciated!
    Thank you
    Mike

    camera_jen wrote:
    ngarver586 wrote:
    Seems ridiculous and annoying to me. Not sure what rate they were offering but I'm sure you could find likewise somewhere else. Have you tried?Not yet.  My lease is up in June of 2016 so I have a while, I just had them pull my credit to check and get ahead of any issues they may have.  The past issue was I didn't have enough credit.  Now it's that I opened multiple credit lines in 6 months.  They didn't even offer an interest rate, just flat out said that based on what they see they will not offer me financing at all.  And it seems inconsistent because I know someone who was financed through them and that person is a train wreck.In regards to trainwrecks, yeah it blows my mind when things like that happen. I see it all the time with credit cards. I would shop around quite a bit and see what you can come up with. What rate do you require for a comfortable payment?

  • Bex report for the average calculation

    Dear All,
    I like to make a Bex report. On that I like to distribute the last 3 months data on daily average basis.
    From there what will be the stock out of the particular day ( in no.s and from the average value), it should be shown in one line rather than all value.
    Please, guide me how to do.
    regards,
    Balaram

    Hi,
    Try the following
    Create variable1 against 0calmonth with ready for input ....Manual Input --- Mandatory
    Create Variable2 on 0calmonth with out ready for input --- customer exit - interval
    go to cmod write customer exit variable to to populate value for variabl2
    eg. if variable1 = 03.2011  Then variable2 should be between 01.2011 - 03.2011 (If you need coding please let me know)
    Free Char
    Row
    0calday/ Sales Document Date / Billing Date (choose which one you need and select only out of them )
    Column
    Sales Qty 
    --Create New Selection and name as 'Avg Qty 3 Month' 
    --add sales Qty in to new selection
    --Drag and drop 0calday/ Sales Document Date / Billing Date (choose which one you need and select only out of them )
    --Right Click on it and restrict with 0calmoth variable2.
    --Context menu of 0calday/ Sales Document Date / Billing Date (choose which one you need and select only out of them ) and tick constant . 
    make it hide in property
    Create New formula
    Avg Qty 3 Month / 90
    Please note there is leap year also ... it better to calculate no of days between rage in formula...
    Hope this will help you to sole the issue...
    Thanks
    BVR

Maybe you are looking for

  • DTW Error while importing A/R Invoice

    Hi,    Iam using SAP B1 2005B Patch 38 When importing Item type A/R Invoices using DTW  it shown the following errpr message customer record not found[INV1.ActDelDate][Line:1]Application-defined or object-defined error..." In my Item master data i cr

  • Report Level Calculation query.

    Hi Experts,   I have a query on one of my reports. I had notification,task no in rows and three other key figures  in columns 1)no of properties failed          which will be at notificatn header level. 2)no of properties remedied    whcih will be at

  • Error when connecting(DBCO) from R/3 database to external database (mssql)

    Hello, We are having issue while connecting from SAP R/3 quality server to external SQL (development) Database(Radar server). We have created the Database connection (RADAR_DEV) in both development and quality r/3 server. Both of these servers connec

  • Misleading messages in JDeveloper IDE

    I think I found a potential major bug in JDeveloper with JSP. This is how it happeed. After I modified the bean(beanname also) and added more elements, I can compile the bean JSP successfully and when I run it, it says Running - compiled successfully

  • Search Complaints by Code/Codegruppe/Katalogkart @ item level in Web Ui

    Hi All, I have a requirement to search complaints BUS2000120 in the Advance search screen BT120S_CPL by item code,codegruppe & katalogcart. So what i did - have added the fields in the search structure throgh an append & the fields are available on t