Calculations Translation- Bex vs Transformation

Hello gurus,
here is the line that I d like to translate in BW, and I d like to know what's the better way of implementing it in BW, is it in Transformation (formula/calculation), or in Bex.
result = (1/3) x (sum of prior 3 month balance from date entered) x (number of days in the past 3 months) / (sum of prior 3 month sales)
Assumption is that user 's input is 1 Month period. (please write the line in abap if you re thinking that it is easier).
Thanks,

Hey Suhas,
i have this code below, but  I am the call fm get days in Month return 0, what do you think is the problem?
(i am operning a new thread although it is a continuation for this one here:
Customer Variable to return number of days previous months )
DATA: l_s_range TYPE rsr_s_rangesid.
Data: noOfdays type i,
      date_prev1 type /OSP/DT_DATE, date_prev2 type /OSP/DT_DATE,
      date_prev3 type /OSP/DT_DATE,
      var_yr type n length 4,
      var_mth type n length 2, var_mnth_prev1 type n length 2,
      var_mnth_prev2 type n length 2, var_mnth_prev3 type n length 2,
      var_day type n length 2,
      ev_days_prev1 type /OSP/DT_DAY,
      ev_days_prev2 type /OSP/DT_DAY,
      ev_days_prev3 type /OSP/DT_DAY,
      I_NUM_DAY type n length 2,
      loc_var_range LIKE rrrangeexit.
CASE i_vnam.
WHEN 'Z_F_RETURN_3MONTH_DAYS'.
  IF i_step = 2.
    LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZC_PERIOD_SR'.
    CLEAR: var_mth, var_yr, var_mnth_prev1, var_mnth_prev2, var_mnth_prev3.
    CLEAR: date_prev1, date_prev2, date_prev3, ev_days_prev1, ev_days_prev2, ev_days_prev3.
    var_mth = loc_var_range-low+5(2).
    var_yr = loc_var_range-low+0(4).
    var_mnth_prev1 = var_mth - 1.
    concatenate var_mnth_prev1 '01' var_yr into date_prev1.
   var_mnth_prev2 = var_mth - 2.
   concatenate var_mnth_prev2 '01' var_yr into date_prev2.
   var_mnth_prev3 = var_mth - 3.
   concatenate var_mnth_prev3 '01' var_yr into date_prev3.
    CALL Function '/OSP/GET_DAYS_IN_MONTH'
    exporting IV_DATE = date_prev1
    importing EV_DAYS = ev_days_prev1.
    I_NUM_DAY = ev_days_prev1.
   CALL Function '/OSP/GET_DAYS_IN_MONTH'
  exporting IV_DATE = date_prev2
   importing EV_DAYS = ev_days_prev2.
   CALL Function '/OSP/GET_DAYS_IN_MONTH'
  exporting IV_DATE = date_prev3
   importing EV_DAYS = ev_days_prev3.
    noOfdays = ev_days_prev1 + ev_days_prev3 + ev_days_prev3.
    l_s_range-low  = noOfdays.
    l_s_range-sign = 'I'.
    l_s_range-opt  = 'EQ'.
    append l_s_range to e_t_range.
    ENDLOOP.
  ENDIF.
ENDCASE.

Similar Messages

  • YTD calculation from BEx is not working in Advance Analysis for OLAP/OR Office

    I have AA for OLAP based on BEx. There are YTD calculation in BEx Designer: User enters Period in variable, and in user exits, the Period Range is populated as "1 ~ UserEnteredValue" in second variable. In BEx, YTD is calculated based on the Restrictive KF for the period range, calculated in User Exit. This is working fine in BEx Analyzer, however in Advance Analysis (for OLAP OR in Ofice), the YTD value is not coming up they way it is in BEx Analyzer...
    Anybody has any clue, why??
    Thanking all of you in advance  

    Hello Sharma
    If something is working for BEx Analyzer but not for Analysis OLAP or Analysis Office then this typically (but not always) indicates an issue with the BICS (BI Consumer Services) component.
    I would suggest you contact support about this so the appropriate logs can be captured and the issue investigated by the BICS team.
    Regards
    Ian

  • Currency Translation and Account Transformation Business Rules Together?

    Hi I am fresh out of college and working on a BPC project. I have this working but fear down the road problems.
    We are using currency translation and struggling with getting our NetIncome to write the correct value to the Current Year Retained Earnings when it converts from LC to USD; USD value did not match Net Income in P&L.
    Initially, we did the Account Transformation first in our default logic only on LC, then FX runs and creates the corresponding USD value which does not match the Net Income.
    It looks like the logic is correctly summing the YTD value but it converts using the AVG rate for the period (as opposed to multiplying each month by that monthu2019s average rate) creating a variance.
    Weu2019ve moved the account transformation to run after FX and have it also running on USD. This currently works but seems like a workaround, and as we configure the remaining CTA rules will we run into problems?
    Have any experts run into this issue before and what should I do?
    Edited by: MichaelUCF2010 on Oct 12, 2010 10:18 PM

    Hi, perhaps this is my lack of accounting knowledge rearing itself.
    RE = BS = End (if you take into account translation adjustment for Net Income and Additions/Substractions & OB)
    However If you are talking about the RE Reserve (and computing that correctly)
    RE Reserve
    OB - Opening
    Inc - Avg
    Sub - Avg
    NI - Avg [I assume it is this line you are talking about - please try the apply periodic option for avg]
    CTA - calculated
    CB - End

  • Calculation in BEx on Hierarchy Link Nodes

    Hello everyone. I am working on a BEx query that involves a hierarchy based on Controlling Area, Cost Center, and Cost Element. There is a case where I have 5 Cost Elements that belong to 2 Cost Centers. I can successfully create the duplicate nodes at the different Cost Center levels and activate the hierarchy. Where I am having difficulty is assigning a percentage factor to the key-figure at the parent-node (80%) and the link-node (20%). The high-level node at CO_AREA is correct. However, the COST_CENTER nodes show the total original value. I would like to apply these factors dynamically in the BEx query. I have tried structures and cell definitions and was able to apply the 80% and 20% factors correctly to the corresponding hierarchy nodes. Unfortunately, the amounts are not broken down as I would like to see them.
    I have looked at the documentation on "Link Nodes" and "Modeling Nodes and Leaves: at help.sap.com.
    http://help.sap.com/saphelp_nw04/helpdata/en/b3/fa3d3806136268e10000009b38f8cf/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/80/1a6743e07211d2acb80000e829fbfe/content.htm
    This is from one of the above links:
    "For both duplicate leaves and leaves in subtrees under link nodes, the values of the duplicate leaves are only considered once by the system internally. When aggregating, the system automatically calculates what are called correction leaves for the superordinate node.
    If a leaf Lo lies three times amongst the descendants of a node No, the value is added three times internally and then subtracted twice by the ’correction node’."
    I'm wondering if it is even possible to do what I would like to accomplish.
    I would appreciate any feedback and suggestions on how to solve this issue if you have done something similar.
    Best Regards,
    Albert Pecoraro
    Sr.SAP BW Specialist
    Ferro Corporation
    Example:
    CO_AREA_1000 = Total = <u><b>$1000</b></u> (AAAA = $800, BBBB = $200)
    --><u><b>COST_CENTER_AAAA</b></u> = $1000 @ 80% = <u><b>$800</b></u>
    >COST_ELEMENT_100 = 100 @ 80% = $80
    >COST_ELEMENT_101 = 200 @ 80% = $160
    >COST_ELEMENT_102 = 300 @ 80% = $240
    >COST_ELEMENT_103 = 150 @ 80% = $120
    >COST_ELEMENT_104 = 250 @ 80% = $200
    --><u><b>COST_CENTER_BBBB</b></u> = $1000 @ 20% = <u><b>$200</b></u>
    >COST_ELEMENT_100 = 100 @ 20% = $20
    >COST_ELEMENT_101 = 200 @ 20% = $40
    >COST_ELEMENT_102 = 300 @ 20% = $60
    >COST_ELEMENT_103 = 150 @ 20% = $30
    >COST_ELEMENT_104 = 250 @ 20% = $50

    Hi Alberto,
    Would you please post the resolution of the issue with the hierarchy node calculation? I too have a simillar requirement. It would be helpful if you share the solution for tha issue that you had.
    Saravana

  • Calculation in Bex Query

    Hello Experts,
    I am developing a report with Bex and I would like to achieve the following:
    I have 0fiscper on the rows and sales amount KF on the columns. When I run the report, I get the following results:
                  Sales
    001/2006      40000
    002/2006      35000
    003/2006      60000
    xxxxxxxx
    Overall Result xxxxx.
    I would like to be able to calculate % sales for each period / cumulative sales YTD * 12 /number of periods. The Overall Result is what gives me the cumulative YTD sales but my question is:
    How can I use the period in the calculation? Any help would be greatly appreciated.

    hi Rue,
    what's no of period here ? total period (12 or 16) ? of total of period displayed like in your sample is 3 period ?
    you can use %GT (percentage of overall result),
    try to create 2 calculated keyfigures,
    one to hold number of periods, and the other for the calculation,
    - if you mean total period displayed, right click 'keyfigures' and 'new formula', give description e.g 'no of period', and type in 1 in formula area
    - 'new formula' again, double click 'percentage of overall result' in percentage function (you will see %GT), and drag 'sales amount' kf to formula area, then 12 * 'no of period', you formula may look like
    %GT 'sales amount' * 12 / 'no of period'.
    to set decimal places, right click the ckf and properties.
    hope this helps.

  • How to add % symbol to a KF calculation in Bex

    Hi
    I am using my own formula for % Calculation in a Bex Formula (Not using an standard % functions)....Is there any way that i can insert % symbol to the result displayed in the report
    Thanks

    Hi ,
    Yes you can use a workaround by crating a new formula (F1)  based on your formula ( F2) such that
    F1=F2 %A 1
    Hide F2 and disply just F1 in your report.Using the above formula you are deceiving your formula to just display its value as a percentage of 1.
    This will solve your issue.
    -Mayuri

  • Variable to store a result of a complex calculation in bex query

    Hello all,
    I've got a query in BEX with some key fields to display and also need to perform some calculations not supported in bex formulas.
    I think this could be made in a BEX user exit and I'm trying this by creating a project in CMOD assigning EXIT_SAPLRR0_001... Working with INCLUDE ZXRSRU01 and so on.
    I just want to know if this is possible this way because I execute my query and the variable created never get any value at runtime.
    Could anybody help me or give an idea on how to use BEx user-exits?
    Thank you very much,
    Carlos Hinestrosa.

    Hi!
      I think it should work .here are some links to help topics on using user exits.
    presentations
    https://websmp206.sap-ag.de/~form/sapnet?_FRAME=CONTAINER&_OBJECT=011000358700005475091999E
    Help:
    http://help.sap.com/saphelp_nw04/helpdata/en/e3/e60138fede083de10000009b38f8cf/frameset.htm
    propably they might help you
    With regards
    Ashwin

  • Date Calculation in BEx

    Hello All,
    In my report, User wants to see a day counter which is the dfference of a date (date coming from cube) and Current date. For current date  we are using 0f_aday sap exit. How we can we acheive this, does it involve any User exits at the back end or can I use a calculated keyfigure to find the difference between these two dates.
    Please reply to this as it is very Urgent Issue
    thank you

    HI AL,
    Thanks for the udpate. But I believe we can update any thread if its related with the same subject if its less than 3 years. Is it not right ? I have a mail in my inbox, from some moderator confirming the same. That is the reason I have updated this thread...as its related to the same question and this thread is created n 2011.
    Anyway, thanks for the answer. I will change the dimension to date and calculate the difference from the 2 variables.
    Reg another doubt, from the below link...
    https://docs.google.com/viewer?a=v&q=cache:YQS2jPhWysAJ:www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/705734f2-4e85-2e10-2ebf-891d0110de74%3FQuickLink%3Dindex%26overridelayout%3Dtrue+&hl=en&gl=au&pid=bl&srcid=ADGEESjL8dx81tAAJNL0Ln4c2MW4k3yZRDNFsop1pptOc3bQf1xU0Le9e3loFsZXJi5rWuYt3j7yoStGMktsL5XEdV9T3ONzdKay0x5yrIbaUBB3Dpz1Fr6xuggf_IZX-S0Q4WONpBhN&sig=AHIEtbTZfXXLN4gZCsw7qpZXgrkjeCYLcA
    what is the field used for Interval ( from, to , range) . You have missed my other question, why am I getting X below the result while doing the date calculation . I mean I am getting the result, but below every row, there is a X . Any ideas ?
    Thanks,
    DR

  • Ageing Calculation in Bex

    Hi,
    I need to calculate the Ageing in a Bex Query based on the Current date & Clearing date.  To calculate Ageing, i am first trying to get the difference between Current date & Clearing Date.  By refering a PDF posted here in SDN for Ageing, i created the Current date as Customer exit & the date value is getting populated for this, i checked this through debugging the Customer exit. 
    Whereas, For the Clearing date, i created a Formula Variable with Replacement path assigning Clearing date as the Reference Characteristics.  As per the document for the Replacement Rule, i gave 'Attribute value' as the Replace with.  But for this type, in the Dimension(Last tab in Variable creation screen) 'Date' is not coming up, only Quantity, Amount etc. are coming in.  So, in the output, i am not getting the difference in Numbers, instead its giving up the Current date.
    Any help on this will highly be appreciated.
    Regards,
    Murali

    Hi Murali,
    In the document you had referd to has the data field as attribute thats why in the document reference it was selected as attribute, in your case it will key not attribute as clearing date is itself a char not a attribute of any IO.
    select key and check in the last tab you will find date.
    Difference of dates will be numeric value only not the dates.
    Documents in SDN are only for reference the procedure may warry depending on the business requirement.
    Regards
    KP

  • Query regarding row level calculations in Bex

    I have a scenario where I am creating a report on a multiprovider. This multiprovider is based on General Ledger and Profit Center Accounting cube. The PCA cube has accumulated balances at G/L account and profit center level, and GL cube has balances only at General Ledger account level.So when a report is created on this the data displayed looks like:
    Account Profit Center Balance
    1000             1234            100000  - From PCA cube
    1000              2345            200000  - From PCA cube
    1000              Not assigned 400000 - From GL cube
    There are some cases where the total balance at G/L account level does not match both the cubes ( as in the above example, as per PCA, balance for G/L account 1000 is 300000 whereas as per GL cube, balance at G/L account 1000 level is 400000.)
    Hence we require a separate row showing this difference ( not column)
    Therefore actual output required for the above scenario is:
    Account Profit Center Balance
    1000             1234            100000 
    1000              2345            200000 
    1000              DIFFERENCE           100000 - (400000 - sum of above 2 balances)
    Total                                 400000
    It would be very helpful if anyone can give inputs on how this can be achieved.

    Have you considered Virtual Key figure. This will allow you to do such complex calculations.
    Thanks
    Sharan

  • Periodwise calculation in bex?

    hi sdn gurus,
    i have 2 requirements.
    i have std price and moving avg price key figures.
    1st requirement is
    a) if i enter current period it should calculate the current std price and previous period's std price and it should display the variance between current period and previous period,
    b) if i enter current period it should calculate the current period's moving avg price and previous period's moving avg price and it should display the variance between current period and previous period,
    2nd requirement is
    if i enter current period iit should calculate the current std price and previous year's last period's std price and it should display the variance between current period and last year's last period(i.e 12th period).
    how to create the variables to get the report done.
    inputs pl
    regards

    hello Venu
    Restricted Keyfigures will serve your purpose in both of your requirements.
    Create a Variable for the FiscalPeriod which you had got in your Infocube,
    1a) Use 2 Restricted KeyFigures
    one RKF will be like Restricting the Std Price with the Fiscal Period which is getting populated from the Variable
    Second RKF will be Restricting the Std Price with the Fiscal Period with a variable offset-1 will provide the Previous Std Price
    Use one more Calculated KF for which data will be the Variance of above two RKF's
    1b)Use 2 Restricted KeyFigures
    one RKF will be like Restricting the Moving Average with the Fiscal Period which is getting populated from the Variable
    Second RKF will be Restricting the Moving Average with the Fiscal Period with a variable offset-1 will provide the Previous Std Price
    Use one more Calculated KF for which data will be the Variance of above two RKF's
    2. Here hope you can use Fiscal Period for which you will be entering the Period and Fiscal Year for which u will enter the  current year.
    use two RKF
    one Std Price restricted with the Fiscal Period of current period
    second Std price restricted with Fiscal Period = 12 and the Fiscal year restricted to the variable offset of curretn year -1
    calculate KF can be used to display the variance of both the above RKF
    hope you understand
    Regards

  • Incentives calculation in BEX

    Hi,
    Requirement as follows
    TARGET
    SALE
    SALE RETD
    NET SALE
    %OF ACHIEVEMENT
    RATE OF INCENTIVE
    Sale is a restricted Keyfigure which is defined as follows
    0DOC_CATEG(Sales document category) restricted to Debit memo
    0NETVAL_INV(Net value of billing item)(Table VBRP Field NETWR)
    Sales returns is another restricted keyfigure defined as follows
    0DOC_CATEG(Sales document category) restricted to Creditmemo
    0NETVAL_INV(Net value of billing item)
    ·         Net sales = Sale  -  Sales returns
    %Of Achievement = Netsales % Target
    Rate of incentive is calculated based upon the following conditions
                            If 100 % achieved 2.%   incentive
    I                         f 80-99.99% achieved 1.%  incentive
                            If over and above 100% achieved 1%incentive
    This incentives data is not stored any where so how can I build the formula for this
    Regards
    priya
    So please send me the formula for Rate of incentive calculation

    Hi Jasprit Singh,
    Rate of incentive is given based on the % of achievement as well as payments received within 75 days,if payment is not received with 75 days then incentive is not given
    Example Basline date is 12/12/06
             Due date is 28/01/07
             Clearing date is 30/02/07
    The customer has to make the payment by 28/01/07 fromthebasline date the days given from baseline date  to due date is 1 month 17 days but the customer cleared the payment on 30/02/07 means he took totally 80 days from the baseline date so this customer is not provided with incentive pls suggest how to write formula for this
    can i get ur mail id
    Regards
    priya

  • How is YTD calculated in bex ?

    we have a requirement to calculate YTD for revenue in a report. Just want to understand if YTD is always the current year restricted to KF or we need to consider the value from the user like 0fiscper and adjust YTD, as per the user input. I mean for example if user enter input 002.2013, then the YTD will have 2013 value or still 2014 value because YTD is current year to date.
    My reporting requirement is as below. red are colmns.
    customer           YTD revenue              Feb 2013 ( user input value- revnue will be fetch based on user input).
    But YTD will be always for current year right ? Does it depend on the user requirement ? Should I ask user or its generic, Please confirm.
    Thanks
    DR

    The reason I put this thread is to find out how is YTD calculated normally in a report. Will it be always the current year data to be displayed or it depends on the requirement. Hope you would have handled YTD in your reports, can you please clarify.
    Anyways' thanks a lot Anshu and Suman. You guys are experts and always provide prompt respone to me. and provide different approaches even on weekends. I appreciate it. Have awarded you guys full points. I will try your approach on monday will post you questions. I got the clear picture to display text for column heading and restrict 0fiscper for the data column. Will try YTD after you confirm or more inputs from the user.
    Thank You once again.
    DR

  • Calculations in Bex

    Hi All,
    Currently i have to design a column let keep it as A.From a multicube.
    In this column i need to get values related to Sales documents and Deliveries.
    For sales documents we have created a routine which calculates and brings the open quantities values and this needs to be shown in coumn A.To show this i have created a CKF to capture this value and i have defined a RKF with other restirctions.
    But for Deliveries we have to bring in the netprice along with the billing status conditions.Now goes the tough part can someone tell me how can i get this deliveries values also in column A.i.e i need to add this in the CKF which i have created and for the restrictions part i have another set of restrictions which have to go in the RKF which i have created.How can i do this.
    Regards,
    Harish

    Hi Harish.
    I would worry about "integrating" the two numbers later. First, you need to be able to produce the two components you are referring to. Once you get to this point, you can just add them in a CKF...
    From what I get, it sounds like your challenge is to produce the Deliveries part - " the net price along with the billing conditions ". Is it because you need to do another calculation here first, or what is the problem with the Deliveries part?
    Regards
    Jacob

  • How to use CHARS in Calculation in BEX Report

    Hi,
    Two chars withy data type TIMS in my Cube
    Open Time & Close Time
    My requirement is to calculate NO of Hours worked which is Close Time – Open Time
    But as they are Chars How can I use them in Calculation.
    Thanks

    Hi Bhanu,
    I created Formula variables and used them in calculations but it is not working as desered.
    Lets Take this scenario
    Open Time (Char-TIMS) value in Cube : 08:30:00
    Closed Time (Char-TIMS) value in Cube : 10:00:00
    The store is opened at 08:30 and Closed at 10:00 so the result expected by calculation WORKED HOURS :1.5 Hrs
    But When i converted open time char to formula variable  it is converting 08:30:00 to 83000 and Closed time 10:00:00 to 100000 and result of cal is 170000
    Please advise me on how to proceed
    Thanks

Maybe you are looking for

  • Query help on Goods Receipt Query with AP Invoice

    Looking for a little help on a query.  I would like to list all the goods receipts for a given date range and then display the AP Invoice information (if its been copied to an AP Invoice).  I think my problem is in my where clause, I plagerized an SA

  • Windows 8.1 notebook , recovery using recovery disc

    my spouse after  spending less than 10 hours in 20 years of having computers in our home thought he had made recovery discs after I purchased his notebook for him. It turned out he did not follow the instructions correctly and made only 1 recovery di

  • Error APP-FND-01516 INVALID APPLICATION USERNAME, PASSWORD, OF DATABASE

    Hi Guru's, I've installed 11i - 11.5.9 on 2000 Server. I'm Facing an Error after initialization of applet. I'm mentioned the exact error bellow. APP-FND-01516 INVALID APPLICATION USERNAME, PASSWORD, OF DATABASE Username : APPLSYSPUB Password : PUB Da

  • How to get name of batch file/shell script that starts program?

    I don't think there's a way to do it, but I'm asking the question anyway... of course, the startup script could pass its name as a parameter to the Java program, but I was wondering if the information could be determined "directly," via Java code. Th

  • Duplicate photos already in photo library

    Is there a way to scan your i-photo library and automatically select/delete all duplicate photos? After just recovering lost/accidentally deleted photos, I now have thousands of duplicates in my library, even tho I had selected to not import duplicat