BEx Formula Problem (If-Else)

Hello everybody,
I am heaving a little problem with the BEx Formula Editor.
I would like to create a formula based on time dependent attributes; witch should provide me with an actual customer rebate.
The Query should look like (displayed in Excel/Analyzer):
Customer Rebate A Rebate B Rebate C Actual Rebate
1         5 %     10 %      0 (#)       10 %
2         2 %      0 (#)    0 (#)       2 %
3         5 %      0 (#)    0 %         0 %
Rebate A, B, C are attributes of different characteristics and for being able to use them in my formula (for Actual Rebate) I have created a formula variable (replacement path) for every rebate. I have already figured out, that there is no possibility to differentiate between real zero values and zeros being displayed because there is no value defined (#) (at least it seems so to me). So I added another attribute which is 1 if there is a value. For the following example let’s call it “Rebate X (exists)”
The formula I would like to use should contain the following logic:
If (Rebate C (exists) == 1) {
Actual Rebate = Rebate C
} elseif (Rebate B (exists) == 1) {
     Actual Rebate = Rebate B
} elseif (Rebate A (exists) == 1) {
     Actual Rebate = Rebate A
} else {
     Actual Rebate = 0
Any help would be appreciated.
Kind Regards
Simon Ulrich

Hi,
I suppose Eugenes Formular will give you the total of all three rebates if they all exist. To get the elseif correctly, I propose a formular like
(Rebate C (exists) == 1)* Rebate C + NOT (Rebate C (exists) == 1)* (((Rebate B (exists) == 1)*Rebate B) + NOT (Rebate B (exists) == 1) * ((Rebate A (exists) == 1)*Rebate A))
Hope all brackets are set correctly, slightly confusing in this editor

Similar Messages

  • Can i now exact bex formula to be inserted

    Can i know the bex formula to be used by if  else statement in bex query.
    if f9 greater than e9  then result should be  E9*B9   else  F9*B9
           IF(F9>E9,E9*B9,F9*B9)

    Hi Naiduz,
    There I have missed one point, you have to create a formula variable for both these fields and with replacement processing type. Then only you can use the formula like this.
    Hope this clarifies totally.
    Kindly refer the doc for more understanding. It has been explained crystal clear here.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d08b56a8-daf5-2e10-2397-904d6aeb55c2?QuickLink=index&…
    Thank you.
    Chandan Praharaj

  • BEx Formula Use of 'Logical And' and Calculation for Gross Margin

    HI Bex gurus.
    Having an odd time with what should be a simple formula to handle the display of gross margin (GM). The goal here is to display GM% properly and the requirement is as follows
    If GM <= 0 then 0.0
      Else
    If GM > 0 and Sell > 0 then ( ( sell - cost /sell ) * 100 )
      Else
    If GM >0 and Sell = 0 then 100
    I am familiar with bex formulas and have referenced the help docs on booleans here -
    Boolean Operators - SAP Business Explorer - SAP Library
    But what is odd is that if I use a calculation or a CFK in the IF, THEN with a LOGICAL AND, the formula does not report correctly
    If I put in a static value, like 77, the expected logic is followed.  I have tried making sure have extra parentheses and changing the order of the statement, to no avail!  I could use some extra brains on this puzzling matter, so you help is greatly appreciated and will award points!
    Thanks
    lee lewis
    Here are the formulas in text and below screen shots.  Wish could copy and past formulas to and from editor!
    GM%77
    ( ( ( 'Order GM' >0 ) AND ( Order Sell  >  0 ) ) == 1) * 77 + ( ( ( 'Order GM'> 0 ) AND ( Order Sell == 0 ) ) == 1) * 100 + ('Order GM' <= 0) *0.0
    GM%
    ( ( ( 'Order GM' >0 ) AND ( Order Sell  >  0 ) ) == 1) * 'REF GM%' + ( ( ( 'Order GM' > 0 ) AND ( Order Sell == 0 ) ) == 1) * 100 + ('Order GM' <= 0) *0.0
    'REF GM%
    (order  sell - order cost /order sell ) * 100 )
    GM%77
    GM%

    Shouldn't you change on of the brackets in your REF GM% ?
    'REF GM%
    (order  sell - order cost /order sell ) * 100 )
    I would put that as
    'REF GM%
    (order  sell - order cost) /order sell  * 100 )
    Not sure what you mean with those red arrows... but in both cases you would be dividing by 0 (order sell = 0).

  • How to use rounded values in BEx Formulas

    Hello,
    I have the following question. Is it possible to use rounded values up to a certain # of decimal points in BEx Formulas?
    I have the following problem.
    Consider this:
    keyfigure val 1 = 0.416666667
    keyfigure val 2 = 72
    val 3 (BEx Formula)  = val 2 / val 1 = 172.799999862
    However, what I need to do is this.
    val 1 & val 3 should rounded up to 2 decimal points. So, I really need the report to show this:
    val1 = 0.42
    val2 - 72
    val 3 = val 2 /val 1 = 171.43
    I changed the number of decimal places on val 1 and val3 to be 0.00. However, it appears that these rounded values are not taken into account in  the Formulas, as if the OLAP still uses the original values from the backend with 9 decimal points. So, no matter how many decimal points I use on the Display tab for a key figure, my val3 or result of my formula is always taking into account the 9 digit decimal values, not rounded values that I want. So in the example above, my val 3 comes to 172.80, which it should be 171.43 instead of you use the rounded values in the calculation.
    Please let me know if there is any workaround where I could force my BEx Formula to utilize the rounded values and not actual values from the backend DSO. Or any other solution.
    Thank you

    If you create a Formula in BEx Query Designer like the one below, it works:
    val3 = val2 / ( TRUNC ( ( val1 * 100 + 0.5 ) ) / 100 )
    The TRUNC function (among other things) actually ensures that your formula takes into account the rounded values that you want.

  • MAX( , ) function in BEx formula

    Hello Experts!
    Does anyone know, how the mathematical function MAX( , ) in BEx-formulas work? Which are the two parameters if i want to have the maximum of the values in one colum? Or does this function work another way?
    Best Regards,
    Peter

    Hello Oscar!
    Thank you for answer! Thats what I want to know but it doesn't solve my problem. If I use calculate result as maximum and if I want to calculate with this value (maximum) than i got a result which is calculated with the sum, not with the maximum which I see as result.
    I do open a new thread for new question...
    Thanks,
    Peter

  • How to define Excel function using BEx formula

    Hi experts,
    May I know how to define the following Excel function using BEx formula?
    IF(AND(Revenue<0,Cost<0),"N/A",(Profit/Lost/ABS(Revenue)))
    Thanks!

    for me its easy to implament logic with * and + rather than  AND and OR respectively
    ((Revenue<0)(Cost<0))Value +((Revenue>0)(Cost>0)) ( Profit&Lost / ABS(Revenue))
    As i have mentoned already,for Else case i have considered (Revenue>0) and (Cost>0)  only.
    Value can be a KeyFigure/Formula/formula variable/CKF/RKF
    its not possible to type characters in the formula window so 'N/A'
    Regards.
    Message was edited by:
            Murali c

  • Setting in BEx formula for calculation of YTD and MAT

    Hi,
    I have to implement 2 formulae in BEx.
    As I am trying to avoide ABAP coding, can anyone please suggest SETTINGS in BEx FORMULA to achieve these below mentioned 2 formulae -
    1 ) Calculate YTD - Average of the sum of the reported quarter values from the start of the year until and including the selected quarter. But, if we enter Quarter 3 and there is no data for quarter 2 then the average should be equal to sum of data for Q1 and Q2 divided by 2 instead of 3 even though user entered Q3.
    2) Calculate MAT - Average of the sum of the reported quarter values for the last 4 quarters. We need to check last 4 quarters. If data is present only for 3 quarters in the last four quarters then the MAT will be data for 3 quarters divided by 3.
    Please suggest BEx formulae settings, if any for the above calculations.
    Thanks a lot.
    Regards,
    Prerna

    Hi
    I am not sure requirement related YTD is possible without customer exits variable
    But regarding your 2nd requirement
    Calculate MAT
    Create four restricted key figures by using offset (0, -1, -2, -3) and restriction characteristic will be quarter.
    Create a calculated key figure "Count of Quaerter". This will consist of "Number of rows" key figure with exception aggr on the Quarter characteristic and aggr will be "Count for all not eq to 0".
    Create a calculated key figure which will be sum of four restricted key figures divided by Count of Quarter.
    Kindly let me know incase further details required
    Best Regards
    Rohit

  • When I try to sign into photoshop elements I keep getting error code 400 connection error. I am connected to wifi and have no connection problems anywhere else. How do I fix this?

    When I try to sign into photoshop elements I keep getting error code 400 connection error. I am connected to wifi and have no connection problems anywhere else. How do I fix this?

    FRANK M
    What computer operating system is your Premiere Elements 9 running on? I will assume Windows 7, 8, or 8.1 64 bit for now.
    As for the Help Menu/Update way for updating, are you doing that with antivirus and firewall(s) disabled? If not, please do so.
    Do you have the 9.0.1 Update of the program installed? What version of Camera Raw do you have installed?
    Premiere Elements 9 is an older program where you can still do manual installs for that one and only Update. And, Camera Raw for 9 is no longer being updated.
    For the 9.0.1 Update
    http://www.adobe.com/support/downloads/detail.jsp?ftpID=4929
    Camera Raw (last update possible for 9) is 6.5
    Camera Raw-compatible Adobe applications
    Adobe - Adobe Camera Raw and DNG Converter : For Windows : Camera Raw 6.5 update
    Please review and consider the above, and then let us know the outcome.
    Thank you.
    ATR

  • Bex formula shows empty cell (NULL)

    Hi,
    I have a bex formula that calculate a few fields.
    sometime there is no value in it (NULL)  and effects bedly on other formulas in the query. (NULL also)
    i have tried several ways  to solve it:
    multiply with 1
    IF condition
    add and reduce 1
    but still the column shows NULL (empty cell)
    thanks a lot for helping me out
    points will be granted
    nir

    Hi Nir:
      Nulls used in formulas give Nulls as results. So you need to deal with the Nulls since the first occurrence, replace the Nulls and use another value instead.
    To evaluate if a null is present use the function "IS_INITIAL" in your formulas, this is a boolean function and therefore has the return values TRUE and FALSE.
    Unfortunately the function "IS_INITIAL" is not available for BEx queries, you can use it on transformations while loading DataTargets.
    Regards,
    Francisco Milán.
    Edited by: Francisco Milan on May 31, 2010 1:55 PM

  • BEx formula: Key figure divided by overall result

    Good afternoon
    I need assistance on how to do the following BEx formula please?
    I have "Sales" totals per "Dealers"
    example:
    Dealer: Sales
    A         10
    B          5
    C          6
    Overall Result  =  21
    How do I create the formula in BEx if I want to divide Sales for dealer A (10) with the 'Overall Result' Sales (21)? Note,
    Your assistance will be appreciated.
    Cj Faurie

    Create a <b>Formula</b> below the <b>Sales Key Fig</b> and use the follwoing <b>formula</b>
    <b>Sales / SUMGT ' Sales'</b>
    <b>SUMGT</b> will be available in the <b>Data Functions</b>

  • Formula Problem in BEx

    Dear All,
    I am using BEx Query Designer to make a query.I view the report using browser. I have 2 keyfigure fields "price" and "forecast quantity". I have to arrive at "forecast Value" = price * forecast quantity using formula in Query designer. Although for each material this proves correct in report material wise. If I see the report customer-wise a customer who has bought 10 materials first the prices are added up andthen the forecast quantity is added up and then the sums are multiplied to get forecast value which is wrong.
    Illustration :
    For Customer 1 :
                    Quantity    Price     Value(Quantity * price)
    Material1   | 2           | 10        | 20
    Material2   | 3           | 10        | 30
    Material3   | 5           | 10        | 50
    Material4   | 7           | 10        | 70
    Total         | 17          | 40        | 170 = Correct value
    But if I see report customer wise I get the value as 17 * 40 = 680 which is wrong.
    Is there any way when I see an aggregation of materials the calculation in formula column first multiplies individual rows and then add the rows to give me final value?
    Regards,
    Ratish
    [email protected]

    Hello ,
               Right click on the calculated key figure select properties enhanced and change to Before aggregation , now the result is calculated correctly.
    But if you use before aggregation, the cubes aggregates are not used, so this will have negative effect on performance , this property is applicable to query level key figures.
    hope it is clear
    assign points if useful

  • Bex Queries: scaling and formula problems

    Hi,
    I have two questions / problems:
    1. I am currently building a query on 0PCA_C01 cube and I would like to perform a scaling of 1000 (e.g. 1000 u20AC become 1 u20AC). This works fine for my actual column (scaling is performed her), but not for my budget column (same like actual however different 0vtype) and my deviation absolute column (actual - budget). Any idea why this doesn't work ?
    2. I have also a column deviation % which is a formular deviation absolute / budget. In the query I have defined following formular: deviation absolute / nodim ( budget). The result though, is wrong. When i try the formular with normal excel formular based on the appropriate cells, the result is correct. Any suggestions what is wrong here ?
    Thank you !!!
    Regards,
    Max

    Hi Tom ,
       You can check the following SAP notes for  this issue :-
    1. 1484847 - "Error #2032" while trying to import BEx query through SAP Netweaver BW connection in Xcelsius
    2. 1390703 - Error #2032 in Xcelsius when attempting to import an SAP query with 2-way SSL connection .
    Regards,
    Lokesh

  • BEX formula

    Hi all,
       I have a problem while defining a formula in BEX Query.
    My formula looks like this.
    (1- ( abs(X - Y) / X )) < 0) * 0 + not(1-( abs( X - Y) / X ))<0)*10
    Requirement is that if X = 0 then output = 0 else 10.
    In th above formula used, if X = 0, it gives error ' divide by zero'.
    I tried to use NONDIV0( )  for the division part, if X = 0, output = 10, which is an error again.
    This is jst a sample of a complex formula I am using. I dnt want to change the whole structure of the formula.
    Any suggetions will be rewarded.
    Regards,
    Adarsh

    Hi,
    (1- ( abs(X - Y) / X )) < 0) * 0 + not(1-( abs( X - Y) / X ))<0)*10
    Requirement is that if X = 0 then output = 0 else 10.
    Your requirement just mentions X, why do you have Y in your formula? For the above requirement, you can simple write
    (X <> 0) * 10

  • BEx - formula aggregation

    Hello all,
    I have a BEx problem which does not seem to be unique, but as yet I have not found a solution.
    I have a query u2013 developed in frontend version 3.5 u2013 which is not showing required results at an aggregated level.
    Consider the following columns: Material1, Material2, Total
    and the following rows: Value1, Value2, Value3
    where Value3 is the following formula: If Value1=0 then Value2, else Value1
    Value1 200 0 200
    Value2 100 150 250
    Value3 200 150 350
    However, I do not want to have Material in the default view, therefore I see the following values:
    Value1 200
    Value2 250
    Value3 200
    In this case I want Value3 to equal 350 not 200.
    The query calculates the formula based on the aggregated data, but I want it to use the detailed data. The example above is the problem in itu2019s simplest form, my query is actually a little more complex than this. I am not able to use u2018Before Aggregationu2019 on a Calculated Key Figure, because my formula is u2018too complexu2019. I have also tried various combinations of u2018Calculate Results asu2026u2019
    The query is based on a multiprovider and remodelling the backend would be complex, if it is even possible. I would like a frontend solution.
    Any suggestions/help would be greatly appreciated.
    Thanks,
    Simon.
    Edited by: Simon Evans on Jul 21, 2008 3:11 PM

    Hi,
    Thanks for viewing the thread. And happy to let you know that the issue was resolved.
    The solution was:
    Two formulas (local) were created, one including the formula variable with replacement path for ZD1, with exception aggregation on ZD1, and the other with formula variable with replacement path for ZD2, with exception aggregation on ZD2. Both these formulas are hidden.
    Another formula (local) was created for u2018time takenu2019 = formula with ZD1 u2013 formula with ZD2, with exception aggregation total on u2018ZDOCNOu2019.
    For the second instance, when one requires exception aggregation on records that has multiple values for keys, a nesting of formulas can be done displaying only the ones required.
    For e.g. a formula with exception aggregation on say characteristic u2018item no.u2019 can be hidden, and included in another formula for exception aggregation on characteristic u2018document no.u2019. This is a typical case where one can achieve calculation before aggregation for a calculated key figure, formula or a counter.
    Hope it might help someone, and saves time and effort for a similar issue posted.
    Also would like to keep this thread open for exploring better solutions.   
    Regards,
    Vijay

  • GETPIVOTDATA formula problem with apostrophe

    Excel 2010 on Win7 - Having a problem with the GETPIVOTDATA formula.
    GETPIVOTDATA(data_field, pivot_table[, field1, item1]
    If "data_field", "field1" or "item1" contain a value that has an apostrophe (i.e. single quote), the function returns a #REF! error. It works fine in all other cases. I tried placing those values within brackets (ex: "[Moody's]")
    and using the old SQL trick of doubling up the apostrophe (ex: "Moody''s"), and combining both those methods. But no luck. Has anyone else been able to solve this problem?
    Thanks.

    Hi Marak,
    Thank you for posting in the MSDN Forum.
    Since the issue is more relate to the end-user, I'd like to move it to Excel IT pro forum.
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.
    Thanks for your understanding.
    Best regards
    Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • What's XCode trying to do with the web?

    I got a popup today saying that XCode want to use my proxy keychain to access the net. What does XCode need the internet for? Is it broadcasting statistics? Or is it just checking for updates or something?

  • No sound no picture

    Had this TV for several years and love it.  Problem is when turned on it has a split second screen light and then nothing, no picture and no sound.  Nothing happened when reset.

  • Slide titles not showing up in TOC - Captivate 7

    Can someone please tell me why my slide titles will not show up in my project?  It just says "Slide 1", "Slide 5", etc...  I've not worked with the TOC much so this is all new to me.

  • Can i run dual monitors on mac book air

    Can I run dual peripheral monitors on mac book air, perhaps through Thunderbolt?  I am converting from a desktop to making the Air Book my main computer but need to run two displays.

  • Saving Forms

    I am currently using Adobe Acrobat X Pro, and I am creating a form that allows the user to fill in certain fields.  I would like the user to be able to save their own copy, but not actually replace the original form. Is this possible and if so, how d