IF THEN ELSE STATEMENT IN BeX Query designer

Hi,
I want to write a query as follows:
IF <Value a> is available THEN <Value a> ELSE <Value b>
I have written it as follows:
(X>0)X+(X<=0)Y
The problem with this equation is,  in case X = 0(number Zero) then Y is not getting displayed. But In case X =NULL (or no values) then Y displayed. This is leading to inconsistency in final result. Please help in rectifying the formula incase it is incorrect or is it because of some program bug in BeX?
Regards
Madhav

This works for me...dont understand y its not working with u!!
it is simple:
(X<>0)X+(X==0)Y
If X is 0, then  0X + 1Y = Y
else
1X + 0Y = X.
What result you are getting in both cases?
as you thing,X value is may not be 0 in your case. It may be 0.00004...something like that...Set Decimal Places to 5 or 6 to X.
Message was edited by:
        Muralidhar C

Similar Messages

  • Where to write IF THEN ELASE statements in BEX Query Designer

    Hi All,
    I need to write a formula in query designer...
    saying that to display the all Quantities in KGs.. Now articles are in Grams and KGs...
    So here i need to perform calculation like... if article is in KGs divide by 1, else if article is in Grams divide by 1000.
    where can i write this logic to perform calculation ...
    Thanks in advance..
    ravi.p

    hi chetan,
    No its not work.. why because i  need to convert the unit of measure in Masterdata Attribute values... that means ) ' 0grooss_wt'.  this is  attribute as a keyfigure of ' 0material' .. this ' 0gross_wt' values has to convert in KGs. at Present ' 0gross_wt' values are in KG and Grams...
    I can change these values in update rules by writting  Routine.. But I need to convert it in KGS at BEX Query Designer Level..
    I need calculate like this
    quantity sold * Gross Weight. 
    here Gross Weight is the formula variable which replacing the values of gross weight...
    i tried by creating conversion types in RSUOM t-code. but it works on keyfigures of infocube.. not on attribute values of master data...
    is there any solution to solve this Problem...

  • IF...ELSE.. STATEMENT in BEx Query Designer

    Hi,
    Why there is no IF, ELSE function in BEx Query Designer?
    Assuming I need to write the following logic, how can it be accomplished?
    IF (A=0 OR B=0)
        THEN 0
    ELSE IF ( B/A <0)
        THEN '       *'
    ELSE
        B/A * 100
    i.e.
    if A or B is equal to 0, then display the value of 0
    else if B is negative (as A is either 0 or positive), then display the following text: '         *'
    otherwise, display the value of  B/A * 100
    Thanks!

    Hi,
    You can achieve this by creating a new formula.
    You have to use the boolean operations and mathematical functions. But we cannot display *. u have to display some value for that.
    Khaja

  • IF and ABS condition statement in BEX query designer

    Hi,
    I would like to ask the best way for me to produce an acceptable result from Excel IF and ABS Condition statement.
    The condition statement that I have on my Excel file is
    =IF((A2-B2)>0,ABS(A2-B2),0)
    I'm trying multiple times to reproduce this in BEX Query designer, unfortunately I'm getting a bad result or unacceptable formula.
    Anyone who could help me with my issue?
    Thanks,
    Arnold

    Hi Arnold,
    Thank you,
    Nanda

  • IF ELSE Statement in BEx Query based on the results

    Hi experts,
    I want to realize the following IF/ELSE statement in a BEx Query in respect to the result values
    If the result of KF1 equals 0, than set the KF2 to 0, Else (KF1 NE 0) show the value of KF2
    Background: I want to report the order backlog. In the example above we have an incoming order value of 23.700,80 EUR in periode 12.2013 and an turnover of 22.370,80 EUR in periode 01.2014. The order backlog in ST (KF1) is 1 ST (12.2013) - 1 ST (01.2014) = 0 ST. The order backlog in EUR (KF2) is 23.700,80 EUR (12.2013) - 22.370,80 EUR (01.2014) = 1.330 EUR. The Order and Invoice is finished, but we have an positive order backlog in EUR (reason: less turnover as incoming order).
    For this case I want to realize the IF/Else statement to check if the oder backlog in ST = 0, if yes, than set the order backlog in EUR also to 0.
    Any best practices?
    Many thanks and best regards,
    Michael

    Hi Suman,
    thanks aigain for your reply!
    I have tried your proposal before you have posted it.
    In my special case the following if/else statement works successfully:
    CKF = calculated key figure
    Formula1 = (CKF1 == 0) * 0 + (CKF1 <> 0) * CKF2
    In my case the CKF2 is the result value from "Incoming Order value" - "Turnover"
    So I had to define a separate Formula (1:1 equals to CKF2) and then I was able to set "*CKF2" in the statement.
    The statement CKF2 = (CKF1 == 0) * 0 + CKF2 is not possible (because it´s not possible to calculate from CKF2 itself).
    Now it works
    Best regards,
    Michael

  • If Then Else Statement in SAP R/3 BW

    Hi,
    Does anyone know how to create an If Then Else statement in BEX?
    Thanks,
    Mounika.

    Hi mounika,
    do this way
    If 'material number' > 0.
    rslt = 'enter into table'.
    else.
    rslt = 15.
    endif.
    A True condition always evaluates to 1, a False condition evaluates to 0.
    for more quieries in bw ..pls go through  the link
    http://sap.ittoolbox.com/groups/technical-functional/sap-bw
    pls reward if helps,
    regards.

  • Message in BEx Query Designer Formula

    Hi Experts,
    I need to display message based on the value of the formula result. For Example:
    If K.F1 =<2.5 Then <Message: ODD>
    ElseIF K.F1 >2.5 Then <Message: Even>
    Else
    <Message: Determine the value>
    EndIF
    Thease above messages would be build in the formula column of BEx query designer
    Thanks and really appreciate your response.
    Regards,
    Waseem

    Hello,
    I have done the same funtionality with the help of workbook.
    May be experts can guide us how to display  messages in the formula column of BEx query designer.
    Thanks.
    With regards,
    Anand Kumar

  • Values Bifurcation in BEx Query Designer

    Dear BI Gurus,
    In a column we are getting both positive value and -ve value. We want to bifurcate the values and show only +ve value in one column and show -ve value in another column. Is it possible through Bex query designer?
    Please through some light on this issue.
    With Regards,
    Balachander.S

    Hi bala,
    This can be achieved by creating two calculated Key figures, Just use else if condition in the formula and use if KF1=KF>0 then KF else 0, here all the positive values will be displayed similarly use if KF2=KF<0 then KF Else 0 it will display all the negative values. But here all the values will be displayed. Just hide the Key figure and display only calculated keyfigures. Else you can use exceptions to differentiate the positive and negative values.
    Hope this helps.....
    Rgs,
    I.R.K

  • Cannot see BEx Query in user role profile in BEx query designer

    I assigned several BEx query objects into user profile menu via t-code PFCG first.
    Then expected - when I need and open them in BEx query designer I could find them after clicking "Role" button in  "Open" window. But unfortuantely I'm not able to do that.
    Do I miss anything to archive that? Is other customizing activity else neccessary?
    Thank you for any suggestion.

    Hi Brad.Ma,
    If you can open query from Area "button", after that, you publish it to roles you want assign.
    You try generate Authoriation in Role in Tcode PFCG.
    Hope help you to solve the problem.
    Dao
    Edited by: xuandao_sap on Sep 20, 2011 3:33 AM

  • Results based on From and To value in Bex query designer.

    Dear all,
    We are using BI7.00. In one of our report which pertains to PM user wants to get the details of number of breakdowns which falls in the value range 0 to 1 hours.
    I created a condition which has 2 variables, one is From value and the other is for the To value (since user wants to enter both the limits). I have written a condition that if the breakdown hour is greater than or equal to variable1 and less than or equal to variable2.
    Using the above condition if the query is run, i am not getting the desired output. The values avaialble in the report are 0.65,0.78,1.30,7.38,0 etc., when i give 0 to 1 i should get the values 0.65,0.78 and 0 but instead report displays "No valid results".
    I changed the condition and selected "Between" variable 1 and variable 2 - yet no change in the query.
    To my knowledge i foresee that system is not able to recognize the decimal and hence provides details only based on the whole numbers.
    How to get my requirement achieved in the Bex query designer.
    Experts suggestion with steps will be very useful to solve my problem.
    Regards,
    M.M
    Edited by: Magesh Magesh on Dec 26, 2008 11:28 AM

    Hi Magesh,
    I think you could try one more way.
    Create a formula inserting your two formula variables for limits .(FV -  are ready for input ) .
    The formula would return the result as 1 or 0 because it would have boolean condition in it.
    You could then place a condition in the query designer to only show all records where the value of the formula key fig is 1.
    You formula A would look like
    ( KF > FV1) AND (KF < FV2) * 1.
    And in the condition put A EQ 1.
    You could scale the key figures as well and multiply the limits mentioned by the users in FV1 and FV2 if decimals are still not recognized by SAP.(scaling)
    Regards,
    Sunmit.

  • Difference between  aggregation and calculation tab in BEx Query Designer

    HI,
    I am using BEx Query Designer for my report, for the key figures in the coloumn area i slected one numeric key figures, in  the properties tab i found aggregation tab and calculation tab.
    I need to sum up the total values for that particualar coloumn, when i used calculation tab i found to sum all the values for a particular coloumn, then what is the use the aggreagation tab?
    I not able to used that Aggregation tab it is showing as a hidden fields...
    can any one tell me whats the exact difference between these tabs and when we need to use which tab?
    With Regards,
    Thanesh Kumar.

    Hi Thanesh Kumar,
    I moved this thread from forum Data Warehousing to Business Explorer since it is a query related question (as SDN moderator).
    I could explain to you the difference between these two tabs.
    For "calculation" tab, it changes the display of result and does not change the calculation logic.
    It means that, if this key figure is used further in formula, still the original number (without "calculation" tab setting)  is used for further formula calculation.
    For "aggregation" tab, it changes the real calculation logic.
    The system takes the setting as the aggregation rule for records.
    The most common aggregation rule is of course summation. If you set to e.g. Average here, the system does the
    Average instead of summation when aggregating records. And the Average value will be taken for calculation
    in further formulas or other calculations.
    For "aggregation" tab, you could only use it for CKF (calculated key figure) or formula and you could not use it for
    a basic key figure. That should be the reason why you see it greyed-out.
    Regards,
    Patricia

  • New ratio doesn't appear in Bex Query designer

    Hello Experts,
    I added 2 ratios to my infocube. It activated without any problem. I then added these 2 ratios to my multiprovider and activated it after affecting them to the previous infocube.
    Then I connected to the Bex query designer and loaded a report in order to add these ratios, but there are not available for selection in the Ratio menu of the multiprovider.
    Has anyone faced this problem?
    Thanks

    Try reactivating the Multiprovider again and see if that works !
    I had this issue earlier, where I couldn't see two of the newly added characteristics in the multiprovider. But simply reactivating the multiprovider solved my issue.
    - Danny

  • Usage of formulas in conditions in BEx Query Designer

    Hi guys,
    does anybody of you guys know, if it's possible to use the results of formulas in conditions? I tried it, but the result of the query was "No applicable data found", but there are data for the selection.
    When I'm defining the condition with the key figure (no restricted or calculated key figure), then the query can be executed.
    In my case, I like to define a condition based on a formula result. The value should only be displayed, when the result is greater than 30.
    Any ideas or are there any bugy in the BEx Query Designer?
    Thanks a lot + best regards,
    Clemens

    Hi Clemens,
    I have created a condition in my own system based on formula and it works perfectly fine. Please check following points in your condition change mode,
    1) Condition is marked as Active.
    2) In the block "Evaluate condition below for" you will have to select "All characteristics in drilldown Independently". If you have selected combination of characteristics then you will have to maintain proper sequence otherwise your condition will not work.
    3) In the next block when you set the condition, click on new, in the first block select your Formula from dropdown and set the proper operator in your case you will have to select "Greater than" in the next column set the value of key figure and just trasnfer it.
    Now you are ready to use the condition.
    Regards,
    Durgesh.

  • Char restriction in Bex Query Designer

    Hi Gurus,
    Can anyone explain what is the use of the Characteristic Restriction Area in in the BEx Query designer
    If i set 0CALYEAR =2008 in the Char Restriction and in the column definition i set the one of the column to display data from year 2009. Will it work ?
    Please advice
    Thank you
    BR

    There are two type of characterstic restrcitions in the query. Global and local.
    If you are createing a restrcited key figure or selection and restricting calday then it will be restricted to that particular key figure (and show 2008 data) and in the columns it will show you other years data (i.e. 2009 data).
    But if you are using a global fiter in the filter tab of query designer, then it will be applicable to the whole query.

  • Creating Restrictions in BEx query designer for (1-a), where a is variable.

    Dear All,
    >>  Suppose for the variable in the BEx query designer, I've created restriction for 0FISCPER to the variable 0P_PER (as 0P_PER-1) by right clicking 0P_PER3, from that a dialog box appears.  In that I've selected 0P_PER3 and then clicked on offset variable and when I set the offset variable, it works for (0P_PER-1.etc, 0P_PER+1,etc..)
    But if I want to have (1-0P_PER), then plz tell me how to define this restriction?
    Plz explain me the steps to perform (1-0P_PER) restriction in BEx query designer in BW1.
    I'm using SAP BI 7.2 gui.
    Expecting your reply soon,
    with Regards,
    Jerald

    My requirement is that I want to have " 1-fiscal year"., But this I could not define using offset variables, since using offset we can define "fiscal year +1" or "fiscal year -1". 
    So there would be some other way to define "1-fiscalyear".  So Please help me to define "1-fiscalyear"  by giving me the steps.
    Thank you,
    with Regards,
    Jerald

Maybe you are looking for

  • How to import photos from iphoto?

    Can photos from my iphoto account be downloaded into iphone?  Is this possible?

  • Using names passed to -ComputerName in the output

    Hey guys, Would you be able to help me? When I use the -ComputerName switch in a cmdlet, or function, I get the results as expected. For example: Get-Service -ComputerName server1, server2 -Name myservice* Status   Name               DisplayName Runn

  • Checkboxes displayed as diamonds when running reports in APEX

    I read and implemented the steps offered in other postings on this subject and the checkboxes appear fine when I run the report locally on my PC. However, when I run the report in APEX (not through web service), the checkboxes are still not showing u

  • Problem with Standard Midi files

    When I open a standard midi file in Logic Pro X and I press "play", after a while, let's say a minute, the system crashes and a box inform me that the "System's overloaded. The audio engine was not able to process all required data in time. (-10011)"

  • Is it legal to use skype for fraudulent means?

    Is it legal to be using skype for frauding other skype member? If the answer is No then I think this skype user Bimbola Ijaduola (bimbola50) should be ban from using skype because she as he claim has used it to fraud me and my friend in pretence to b