Re: Bex Formula

Hi All,
I need to create a formula in bex designer.
This is the calculation:
% (A/B - 1)
Say A = 500, B = 100
(500/100 - 1) * 100 = 400 %.
One condition is that, i need to check both the kyefigure
has value.
Incase if B has zero, how to handle it.
what is NDIV0(x) and NOERR(x)? explain pls.
Regards,
Anand.

Hi,
Lets take an example. Let
A=500
B=100
C=NDIV0(A/B)*100.
So C=500
Also D= C OR 0.
Remember OR operator would always return 0 or 1.
If any one of the operands is true... the value returned is 1, only if both the operands are false is the return value 0.
Now Since C=500 hence the value D holds is 500 OR 0 which would return 1.
Now D = 1
Hence the final formula is
CD - 100D that is
500 * 1 - 100 * 1 = 400.
Which is what we needed...
Now lets take another example
A = 500
B = 0
Hence C=NDIV0 (500/0) which would return 0.
Hence C=0
Hence D = 0 OR 0. return value here would be 0 (since both the operands are false).
Hence D = 0.
Now the final formula would be =
C * D - 100 * D which after substitution would turn as
0 * 0 - 100 * 0 which would again be 0.
this is what we needed...
right ?
Let me know...
Rgds,
Sree

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

  • 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

  • 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

  • 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

  • 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>

  • Using Text Variable in BEx Formula

    Hi Everyone,
    I have two columns in BEx query. First column shows the value based on variable ZFISCPER_M(based on fiscal year/period).
    The other column shows the value for period ZFISCPER_M minus 1 (I have used offset in variable).
    So if my user inputs 009.2009, the first column will show values for 009.2009 and 2nd column will show values for 008.2009.
    In the third column I have formula : 2nd column minus 1st column. I want to use text variable to display column heading. The heading in the 3rd column should be 009.2009.
    Can anyone guide me how to achieve this?
    Regards
    Utpal

    Hi Rakesh,
    My first column shows cumulative balance upto 009.2009; My second column shows the cumulative balance upto 008.2009; In the third column I am trying to display balance for the month - not the cumulative figure. So for the third column my heading should be For the month 009.2009
    But when I substract col 2 - col 1in third column; the text variable finds two different values(009.2009 & 008.2009). Hence it is not displaying any text.
    I hope this makes my question clear.
    Regards
    Utpal

  • BEX formula.. How to know the row value in formulas dynamically

    Hi all,
    I just need to clarify a doubt..
    Requirement:
    COL1      -               COL2
    Y1            -               X
    Y2            -               X + 12
    Y3            -               X + 12 + 12
    YN           -               X + 12 + 12 + u2026 12(n)
    Y is dynamic from the source datau2026.. Itu2019s the year (2009,2008u2026 etc..)
    X value is from the user (i/p variable value). Some dummy valueu2026
    Now, the main logic I want to incorporate is like using a formula for COL2
    COL2 Formula looks like thisu2026.          X + (12 * N)             where N= 0 for the 1st row; 1 for the 2nd row; 2 for the 3rd row like thatu2026..
    How to dynamically allocate value for N based on the row count?
    Pls. let me know if you find somethingu2026.
    Thanks.
    Edited by: Arun Bala G on May 21, 2010 10:59 AM

    how abt this:
    This approach only valid for Workbboks..
    create COLUMN3 just type like this
    0
    12
    24
    and drag this upto end of Col1 and Col2 so it will poulate multiples of 12 then in Column 4 apply the C1-C2+C3..
    hope it helps
    Sorry Bhaskar,
    Hardcoding the formula is not relevant at all. May be you had not read this query properly. Its no way related to being dynamic right... If it was Excel workbook, anyone would have used a simple formula & moved values like cakewalk.
    So unfortunate! BEx has some limitations..
    All I need in my query is some counter like 1,2,3.... till the end of the last record. That's all.
    Pl. find the sample data
    COL1     COL2          
    2009     1.3          
    2008     13.3          Which is 1.3+12
    2007     25.3          Which is 1.3+12+12
    2006     37.3          Which is 1.3+12+12+12
    Do let me know if you have any clues?
    Thanks!
    Edited by: Arun Bala G on May 21, 2010 11:20 AM

  • Bex - Formula Calculation

    HI ,
    I'm trying to display a column that show the 'SHARE' calculation in BEX query.
    Share = (Value by Order / Total Value by Order Group )*100
    <order group>      <order>     <value>     <Share>
    ABC                         31000001     $200     28.57%
    XYZ                         31000005     $400     100%
    ABC                         31000007     $500     71.42%
    Note : In the above, order group ABC , Order 31000001, Share = (200/700)*100
    I'm unable to sum up by order group in query.
    Is there any way we can utilize CKF (aggregation) or anything other method that can be used to populate this column.
    Appreciate help from anyone who's familiar with this.
    Thank you.
    Regards,
    Maili
    Edited by: Maili06 on Mar 31, 2011 6:07 AM

    HI Divyesh,
    I'm using an alternative approach. This manage to solve my issue.
    I'm using SUMCT function in BEX.
    I create :
    Formula 1 --> formula sumct(Value)
    Formula 2 --> (Value / formula 1)*100
    Formula 2 provides the share percentage for me.
    I placed the Order group as the first column.
    You may find abt sumct here :
    http://help.sap.com/saphelp_nw04/helpdata/en/03/17f13a2f160f28e10000000a114084/content.htm
    http://www.scribd.com/doc/46732230/SAP-BI-Reporting
    hope it helps you to solve your prob.
    Regards,
    Maili
    Edited by: Maili06 on Apr 1, 2011 11:52 AM

  • 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 change not working in existing Analysis for Olap/Analysis for Excel reports

    Hello all,
    I posted this in Analysis for OLAP, but there has been no response so I'm hoping perhaps you BEx experts can help me.
    I had to modify a formula in a Bex query to have it calculate the results of the formula by summation.
    I checked the query using BEx Analyzer and it summed correctly.  If I create a new analysis for olap report, it sums correctly.
    If I modify an existing report, it does not pick up the change.  Existing Analysis for Excel reports also do not pick up the new summary calculation.
    Using the CMC, I edited the connection and reselected the Bex query, but that did not work either.
    Here it is working in the query:
    Line Discount is a formula with logic checking to see if "product list price total amount" is 0, set the line discount to 0; otherwise calculate it as "product list price total amount" - Net Sale.  So the total needs to sum of the line discounts (0+2820+2820 = 5640) and not be the Overall result "product list price total amount" - Overall Result "net sale" (13960-96720= -82760).
    Here it is in an existing Webi report - working:
    Here is what is happening in an existing Analysis for OLAP report - not working:
    I also tried to unselect Line Discount as a key figure from the existing report and reselect it, but that did not work.
    I'd like to find a solution so that all the reports that use this query won't have to be rewritten.
    I'm on BW 7.0 EP 1 SP 10 and BI 4.0 SP7 Patch 5.
    Thank you for your help,
    Susan

    Hi,
    Apply Exception aggregation on line discount formula--Exception aggregation as Total---Reference characteristic as Promega product.
    Make sure to refresh the webi report once after the changes has been done.
    If this does not work then you can apply summation calculation for that column at webi level as well.
    Regards,
    AL

  • 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

Maybe you are looking for

  • Dynamic Availability Check for Goods Issue,Transfer Posting

    Dear All, Can anyone explain the Dynamic Availability Check?? I mean the relevance on setting this indicator for a mov.type? In OMCM & OMCP I have defined a Checking Rule & also assigned the same to a Mov.type as well the transaction code? whether th

  • Nokia N8 Belle does not show caller name

    I can't get my phone to show names for people that are calling, I know there are already loads of topics about this, but none of the suggestions could fix my problem. Keyfacts: - Nokia N8 with Chinese Firmware (Belle) - All contacts are synchronized

  • External Multimedia Projector with Powerbook

    I use my G4Powerbook, 12", to connect to a multimedia projector for teaching. However, every time it connects it automatically increases the size of the desktop and programs. So when I project images from a website, the images are too big for the scr

  • Adobe reader doesn't open PDF files, get windows media player

    When I go to downloads page in Firefox and try to open a PDF file which has been saved on the Downloads page, Windows media player opens instead of Adobe reader.

  • Why can I surf on Firefox, but not on Safari?

    Hi, I'm running an iBook G4 with 10.4.8 on it. My DSL internet connection is through an apartment server, requiring its own manual network configuration to work. That is the easy part...it took a week to figure out the proxies (the local staff and th