Condition IF in formula of the query!

Hi,
I need to define a Key figure which has values calculated depenidng on the logical expression:
if GID-PRD<= 2 and PRD-GID<=5 then counter should add 1 or 0 depending upon the condition success.
now i had written in the formula as follows:
(GID-PRD<=2) + ( PRD-GID<=5) * count( ).
but it is saying general syntax error.
Can any body suggest me whats wrong in what i had coded?
Thanks,
Ravi

Thanks Bhanu,
It is syntactically correct. but all the results of this KF are 1 irrespective of the condition success.
i had observed there are more fails than the successes but results are always 1.
i am missing something here for sure.
Not sure where
Thanks,
Ravi

Similar Messages

  • Curerency conversion for a Formula in the query designer

    Hi
    I have a ' Financial Loss Formula' in the report. I want to convert this 'Financial Loss' into USD Currency at query designer level.
    Source Currency = SAR
    Target Currency = USD
    So how can i do the curerency conversion for a Formula in the query designer.
    pls let me kow
    kumar

    Hi,
    If you define your query conversion in BW then it is easy to do currency conversion through Bex.What you need to do is use calculated key figure instead formula and do a right click select properties there at the currency translation area you ca select defined currency conversion in BW and your target currency.
    /people/rasim.manavoglu/blog/2007/04/30/currency-currency-currency
    Regards.

  • Creating formula in the Query Designer

    Hi,
    I have a KF which I have to convert in to different unit in the query ( x/data)
    The problem is some of my data in the cube is zero (0) and when I use division, it shows me error (red X) in the query output.( Divide by zero)
    Is there any way to skip this division if the data is zero? How can I set my formula in the Query designer?
    Thanks
    M Kumar.

    Hi,
    Please use the NDIV() or NOERR() function outside of your expression and it will take care of the division by zero.
    See here for details:
    http://help.sap.com/saphelp_nw04/helpdata/en/03/17f13a2f160f28e10000000a114084/content.htm
    Hope this helps...

  • Problem with formula in the query

    HI ,
    In cube I have 2 fileds EU date and US date .
    For example :
    In cube EU date  =07/02/2008
               US date = 23/02/2008
    In the query we have a formula with these 2 fields
    formula is DUE date =  DATE ( ( 'Enter 1 = US; 2 = EU - Asia' == 1 ) * 'Due date US' + ( 'Enter 1 = US; 2 = EU - Asia' == 2 ) * 'Due date EU' )
    In the varaible screeen we have a '"Enter 1 = US; 2 = EU - Asia' == 1"
    So if u enter 1 it takes EU date and display as due date if u enter 2 it take US date and display as due date.
    Problem is :
    When we give  "'Enter 1 = US; 2 = EU - Asia' == 1"---this value 2
    in the report in some cases we get due date as 02/07/2008 instead of 07/02/2008. This is not for all records only few we get like this . and for US  due date this problem  is not there.
    Please suggest what might be the problem.

    Hi,
    Please check again the cell value because it may contain correct value but display may be different.
    You can apply the common display property fot the whole column using the workbook properties and saving the workbook.
    Regards,
    Anil

  • Two conditions in where part of the query out of which 1 is based on length

    hi
    am having two tables and i need to join them to get my desired output. let me explain with example
    table A contains data like
    >
    col1 col2 col3
    12345 sons abcd
    23456 snms bcde
    34567 snms nil
    56478 sons ..
    >
    table B contains data like
    >
    col-1 col-2 col-3
    sons not-subscribed 0
    sons nil-balance 111
    snms not-subscribed 0
    snms incorrect 111
    soai incorrect 111
    >
    i need the output like
    >
    col1_of_table_A col3_of_table_A col-2_of_table_B
    12345 abcd nilbalance
    23456 bcde incorrect
    34567 nil not-subscribed
    56478 .. not-subscribed
    >
    likely requirement in sample query format is
    select a.col1,a.col3,b.col-2 from A a, B b where ((a.col2=b.col-1 and length(a.col3)>length(b.col-3)) or (a.col2=b.col-1 and length(a.col3)<length(b.col-3)))how to achieve this conditional joint?

    Hi,
    in your query i just added '..' instead of null for the row starting with 56478 in table A and executed the query as below and it doesn't give my desired output.
    with a  as
         select 12345 as col1, 'sons' as col2, 'abcd' as col3 from dual union all
        select 23456, 'snms', 'bcde' from dual union all
        select 34567, 'snms', 'nil' from dual union all
      select 56478, 'sons', '..' from dual
       , b as
         select 'sons' col1, 'not-subscribed' col2, 0 col3 from dual union all
        select 'sons', 'nil-balance', 111 from dual union all
         select 'snms', 'not-subscribed', 0 from dual union all
        select 'snms', 'incorrect', 111 from dual union all
        select 'soai', 'incorrect', 111 from dual
       select  col1, col3, col2
      from
           select a.col1,a.col3,b.col2, row_number() over (partition by a.col1 order by b.col2) rn
            from A a
             left outer join b on (
                                  (    a.col2         = b.col1
                                   and  length(a.col3) > length(b.col3)
                                  or
                                   (    a.col2         = b.col1
                                   and length(a.col3)  < length(b.col3)
      where rn = 1
      output is
    >
    COL1     COL3     COL2
    12345     abcd     nil-balance
    23456     bcde     incorrect
    34567     nil     not-subscribed
    56478     ..     nil-balance
    >
    what could be problem?

  • Currency conversion in the query designer level

    Hi
    Iam calculating the 'Financial Loss' in the Formula in the query designer.And it comes in SAR(Saudi Riyals).
    But i want the 'Financial Loss' in USD in the Query Designer. Because i want the USD Financial Loss to be use in some other calculation.
    Please let me know how can we do this one in the query designer. I really appreciate for it .
    Regards
    Kumar

    Dear Ravi,
    Basically there are 2 ways to do it: routine & query level.
    If query level, you need to maintain it first using tcode RRC1, then you use it in your KF in your query. .
    Routine level,
    You can create new KF in info-provider, then in the update rules routine, you can use this function to convert the currency :
    CONVERT_TO_LOCAL_CURRENCY
    Hopefully it can help you a lot.
    Regards,
    Niel
    thanks for any points you choose to assign.

  • Change/View formula in the report ?

    Hi SDNer's,
    Is it possible for the user to view the formula used for a calculation in the report ?
    Any close workarounds? What if the user wants even to change the formula from the report ?
    Please share your thoughts.....any inputs wud really help !!
    Envi - Netweaver 7.0, BEx.

    Hi Werner,
    I have seen that feature and that wouldn't really help us. I was looking for a way out for the user to change the formula in the query ( w/o going to query though ), like change A0.68 to A0.75  from report itself.
    Thankyou though !!

  • Problem to get ResultSet when it is used a Date type in the query condition

    hello ,
    I having a bit of nightmare getting a ResultSet how result of one simple Query for a table when the condition WHERE involve a Date type.
    To change the String value in a date to use in the query condition, I tried both:
    String strDate = "dd/mm/yyyy";
    (1.) java.sql.Date sqlDate = new java.sql.Date(strDate.getTime() )
    (2.) SimpleDateFormat formatter = new SimpleDateFormat(strDate) ; sqlDate = formatter.parse(strDate);
    and finally I use this code to get the ResultSet:
    sql = "SELECT * FROM myTable Where (idCli = " + cd_Cli + " And dateReg = " + sqlDate + ")";
    statement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
    resultSet = statement.executeQuery(sql);
    boolean ok = resultSet.last();
    totNumberOfRegistration = resultSet.getRow();
    But In both the cases I get a empty resultSet.
    I shoul like if someone would look my code to say me where it is the mistake...
    thank you
    tonyMrsangelo
    P.S. I tryed using PrepareStatement too to get the ResultSet, but in that case I couldn't use the ResultSet because executing the statement resultSet.last() I get the error: "Result set type is TYPE_FORWARD_ONLY"

    In a database like Oracle, you need to use a function like TO_DATE; other databases may have something similar.
    However, the proper way to do this is to use a PreparedStatement. Then you can say
    PreparedStatement ps = conn.prepareStatement("update SOMETABLE set SOME_DATE=? where SOME_ID=?");
    ps.setDate(1, new java.sql.Date(someJavaUtilDate.getTime()));
    ps.setInt(2, theId);
    ps.executeUpdate();

  • How to define the query condition of Image Theme in MapBuilder?

    Hi,
    I'm trying to add an dynamic Image Theme in OracleMap, but there's a problem.I defined the query condition of Image Theme like this:
    select scanimage,shap from image where scanimgid=467
    The shap column is the MBR column
    And the XML CODE:
    <?xml version="1.0" standalone="yes"?>
    <styling_rules theme_type="image" image_column="SCANIMAGE" image_format="JPEG" image_unit="M" image_resolution="1.0">
    <rule>
    <features> select scanimage,shap from image where scanimgid=467 </features>
    </rule>
    </styling_rules>
    When i preview this Image Theme ,there is an ORA-00936 error means lack of expression.
    Is there any problem with my definition?Or can query an image from an Image Theme?
    Thanks a lot for your help!
    Message was edited by:
    N.Mars
    null

    Hi Mars,
    predefined image theme definition does not support a "select" statement in the <features> tag. You should just define a query condition in the <features> tag.
    It seems that you are trying to use an image theme in Oracle Maps, but it currently does not support a FOI image theme. You should add a predefined image theme as part of the basemap, and maybe add scales values to set the visibility range of this image theme.
    Joao

  • Creating customer formula to be used in the Query Designer

    hi,
    How can i code a specific formula to be used in the query designer. As an example, i need to calculate dynamically working days between two dates.
    i tried to find the corresponding BAdl interface with no success..
    Do you have any suggestion ?
    Ludovic

    Hi..
    I have a scenario ...  it may help..
    The group HR administrator wants a detailed line item report that lists all employee absences in a given period. The report is to show the employee number, the absence start date, together with the end date of the absence and show the number of calendar days the employee was absent.
    The good thing about using this technique is that no redesign work is needed from your technical BW team, no ABAP is involved and best of all, it quick and easy.
    Solution:
    For this example I created an ODS object called Absence that holds basic employee information along with individual absence record data.
    Follow the steps below:
         Open the BEx Query Designer and create a new report on your chosen InfoProvider.
                  Drag the Employee, Valid from and Valid to characteristics into the Rows section of the screen.
    If needed, apply data selection restrictions to the characteristics as pop up
         Right click on the Key Figures structure and select New Formula
         In the new formula window right click on Formula Variable and choose New Variable
         The Variables Wizard will launch and will require you to specify the variable details.
    ( Click the NEXT button if the Introduction screen appears )
         Enter the variable details on the General Information as shown in  pop up
    Enter the Variable Name , Description and select Replacement Path in the Processing by field.
    Click the Next Button.
         In the Characteristic screen (pop up) select the date characteristic that represents the first date to use in the calculation (From Date).
    Click the Next Button.
         The Save Variable screen (pop up) displays a summary of the new variable.
    Click on the Finish button to save the variable.
         Repeat steps first four  for to create a second variable for the second date to be used in the calculation.
    In the example shown, the characteristic 0DATETO is used to create the variable ABSEND (Absence End Date)
    Define the Calculation............
                The new calculated key figure will now show in the columns section of the BEx query designer
    excute...
    with regards,
    hari

  • Uploading a text file from webi filter area as part of the query condition

    Post Author: balasura
    CA Forum: Publishing
    Requirement : Uploading a text file from webi filter area as part of the query condition Hi, I am in a serious requirement which I am not sure available in BO XI. Can some one help me plz. I am using BO XI R2, webi I am generating a ad-hoc report, when I want to give a filter condition for a report, the condition should be uploaded from a .txt file. In the current scenario we have LOV, but LOV could hold only a small number of value, my requirement is just like a lov but the list of values will be available in a text file ( which could number to 2000 or 2500 rows). I would like to upload this 2500 values in the form of a flat text file to make a query and genrate report. Is it possible in BO XI? For Eg:- Select * from Shipment Where u201CShipment id = u2018SC4539u2019 or Shipment id = u2018SC4598u2019u201D The u201Cwhereu201D condition (filter) which has shipment id will be available in a text file and it needs to be loaded in the form of .txt file so that it will be part of the filter condition. Content of a .txt file could be this shipment.txt =============== SC4539 sc2034 SC2343 SC3892 . . . . etc upto 2500 shipment Ids I will be very glad if some could provide me a solution. Thanks in advance. - Bala

    Hi Ron,
       This User does not have the access to Tcode ST01.
       The user executed Tcode SU53 immediately following the authorization failure to see the authorization objects. The 'Authorization obj' is blank and under the Description it has 'The last Authorization check was successful' with green tick mark.
      Any further suggestions, PLEASE.
    Thanks.

  • The query contains a formula with the operator SUMCT

    I m trying to get query ready for Webi, getting the error as 'The query contains a formula with the operator %RT. Therefore, the query cannot be released for OLE DB for OLAP'
    I have not used any kind of s %GT, %RT, %CT, SUMGT, SUMRT, SUMCT and LEAF, also i have suppressed results / over results from the query, over to it, i have removed the calculate results as 'summation' feature and set to 'not defined' for all of my key figures.
    Still getting the error...
    Please suggest.
    Niraj

    hi,
    Ensure that all Link IDs are visible in the lsdal.ini file  located in the \Windows\system directory of the PAS Server as those are then available to all users. The lsdal.ini file may not be correctly updated if: - You have created the BI Link IDs while using PAS in Client Server Mode - You have enabled multi user access for remote desktop. In this case an additional lsdal.ini file may appear in the user specific Windows directory of someone who may have remotely connected to the system to create the Link ID. That additional lsdal.ini file will only be valid for that specific user.
    Also try adding  "ODBOSECURITY=0" entry to the end of the c:\windows\lsserver.ini file on the server.
    hope it helps
    regards
    laksh

  • In which order does the query's where clause condition is checked

    Hi All,
    can anyone tell me in which order does oracle evaluate the where clause condition?
    for ex: select * from users where user_type='Admin' and stauts='Enabled'

    user9981103 wrote:
    The conditions in the WHERE clause are checked in the reverse order of the given order.
    i.e; first it will check stauts='Enabled'* and then user_type='Admin'* for your given queryWhy do you believe that?
    If there is a sufficiently selective b-tree index on USER_TYPE, the optimizer would undoubtedly use that index to process the USER_TYPE = 'Admin' condition and then check the STATUS column.
    If there is a sufficiently selective b-tree index on STATUS, the optimizer would undoubtedly use that index to process the STATUS='Enabled' condition and then check the USER_TYPE column.
    If there is a composite b-tree index on (STATUS, USER_TYPE), the optimizer would use that index to process the two conditions nearly simultaneously, though technically the leading column of the index is evaluated first. Of course, if you reverse the order of columns in the index, you get a different evaluation order
    If there are bitmap indexes on STATUS and USER_TYPE, Oracle can combine the two indexes and evaluate the two conditions simultaneously.
    And that is leaving out tons of query plan options and other optimizer wrinkles.
    Justin

  • The condition you are adding has caused the query to be invalid.

    I select a column from the structure query: DATA_SET_ID [RDF_STATEMENT]
    I enter a condition: = :P_RSTA_RDSE_ID. (This refers to a hidden field on the page. I have confirmed that the correct value is passed.)
    I click on 'apply changes' and the page returns:
    1 error has occurred
    * The condition you are adding has caused the query to be invalid.
    Previewing the condition gives: (("RDF_STATEMENT"."DATA_SET_ID" = :P_RSTA_RDSE_ID)) which looks fine.
    I've tried a literal - (("RDF_STATEMENT"."DATA_SET_ID" = 1)) - and get the same error.
    I've tried converting to an unstructured query and get 'no data found' where the same query in SQL+ returns the desired rows.

    Mak,
    I will log this as a bug. You may have to recreate the report. Sorry about that.
    Scott

  • Extra condition added in the query

    Hi All,
    I have created a report but its not showing all the results.When I checked the query I saw the extra filter (where ( D1.c7 = 1 )) .I have not added any such filter.Can someone please tell me how this filter has got added and how we can avoid OBIEE to add such filter for this report.Below is the query:
    select T203238.ENTITY_TYPE as c1,
    T203238.ENTITY_NAME as c2,
    cast(T183904.DAY as DATE) as c3,
    cast(TO_NUMBER(TO_CHAR(T183904.TO_TIME, 'hh24'), '99') as CHARACTER ( 30 ) ) as c4,
    concat(concat(concat(concat(cast(TO_NUMBER(TO_CHAR(T183904.TO_TIME, 'hh24'), '99') as CHARACTER ( 30 ) ), ':'), cast(TO_NUMBER(TO_CHAR(T183904.TO_TIME, 'mi'), '99') as CHARACTER ( 30 ) )), ':'), cast(TO_NUMBER(TO_CHAR(T183904.TO_TIME, 'ss'), '99') as CHARACTER ( 30 ) )) as c5,
    sum(T203256.USAGE_VALUE) as c6,
    ROW_NUMBER() OVER (PARTITION BY T203238.ENTITY_NAME, T203238.ENTITY_TYPE, cast(T183904.DAY as DATE) ORDER BY T203238.ENTITY_NAME ASC, T203238.ENTITY_TYPE ASC, cast(T183904.DAY as DATE) ASC) as c7
    from
    (Select a.entity_pk_key entity_fk_key,a.Entity_Name Entity_Name,a.Entity_Description Entity_Description,d.meaning Entity_Type,c.plant_name Site_Name, b.System_Name System_Name,a.Production_Entity Production_Entity,a.Business_Function Business_Function,E.MEANING Status from
    ( SELECT EQUIPMENT_PK_KEY ENTITY_PK_KEY,EQUIPMENT_Name Entity_Name, EQUIPMENT_Description Entity_Description,'EQUIPMENT' Entity_Type, plant_fk_key, System_fk_key, PRODUCTION_EQUIPMENT Production_Entity ,
    NULL Business_FUNCTION, STATUS FROM MTC_EQUIPMENTS_D)a
    ) T203238,
    apps.MTC_HOUR_MV T183904 /* Dim_445_Period_Calendar_Hour */ ,
    ( SELECT e.ENTITY_FK_KEY,e.ENTITY_TYPE, Sum(e.USAGE_VALUE) USAGE_VALUE ,avg(e.N_EXT_ATTR1) N_EXT_ATTR1,avg(e.N_EXT_ATTR2) N_EXT_ATTR2, hour_fk_key FROM
    (SELECT ENTITY_FK_KEY,B.MEANING ENTITY_TYPE, USAGE_VALUE ,NULL N_EXT_ATTR1,NULL N_EXT_ATTR2,hour_fk_key FROM MTH_ENTITY_SUSTAIN_ASPECT A,FND_LOOKUP_VALUES B
    WHERE B.LOOKUP_TYPE IN ('MTH_USER_DEFINED_ENTITIES', 'MTH_OTHER_ENTITY_TYPE')
    AND B.LANGUAGE = USERENV('LANG')
    AND UPPER(A.ENTITY_TYPE)=UPPER(B.LOOKUP_CODE)
    AND METER_CATEGORY ='PRIMARY'
    AND SUSTAIN_ASPECT='ELECTRICITY'
    AND entity_fk_key=1149
    AND hour_fk_key IN(7283,7294,7300,7301,7302,7303,7304,7305,7306,7284,7285,7286,7287,7288,7289,7290,7291,7292,7293,7295,7296,7297,7298,7299)
    )e
    GROUP BY entity_fk_key,entity_type ,hour_fk_key
    ) T203256
    where ( T183904.HOUR_PK_KEY = T203256.HOUR_FK_KEY and T203238.ENTITY_FK_KEY = T203256.ENTITY_FK_KEY and T203238.ENTITY_TYPE = T203256.ENTITY_TYPE )
    group by T203238.ENTITY_NAME, T203238.ENTITY_TYPE, cast(TO_NUMBER(TO_CHAR(T183904.TO_TIME, 'hh24'), '99') as CHARACTER ( 30 ) ), cast(T183904.DAY as DATE), concat(concat(concat(concat(cast(TO_NUMBER(TO_CHAR(T183904.TO_TIME, 'hh24'), '99') as CHARACTER ( 30 ) ), ':'), cast(TO_NUMBER(TO_CHAR(T183904.TO_TIME, 'mi'), '99') as CHARACTER ( 30 ) )), ':'), cast(TO_NUMBER(TO_CHAR(T183904.TO_TIME, 'ss'), '99') as CHARACTER ( 30 ) ))
    ) D1 )
    where ( D1.c7 = 1 )
    Thanks a lot in advance

    No,I am not having any topn or bottomn filters in my query .
    1. I am having entity type and entity name in the report which comes form the view in rpd(view defn:SELECT EQUIPMENT_PK_KEY ENTITY_PK_KEY,EQUIPMENT_Name Entity_Name, EQUIPMENT_Description Entity_Description,'EQUIPMENT' Entity_Type, plant_fk_key, System_fk_key, PRODUCTION_EQUIPMENT Production_Entity ,
    NULL Business_FUNCTION, STATUS FROM MTC_EQUIPMENTS_D) .I
    2. want to see the data at hour level so the hour data comes from apps.MTC_HOUR_MV .
    3. I want to see sum(usage_value) for a entity type,entity name and hour dimension .Sum(usage_value) comes from the view in rpd which has the definition:SELECT e.ENTITY_FK_KEY,e.ENTITY_TYPE, Sum(e.USAGE_VALUE) USAGE_VALUE ,avg(e.N_EXT_ATTR1) N_EXT_ATTR1,avg(e.N_EXT_ATTR2) N_EXT_ATTR2, hour_fk_key FROM
    (SELECT ENTITY_FK_KEY,B.MEANING ENTITY_TYPE, USAGE_VALUE ,NULL N_EXT_ATTR1,NULL N_EXT_ATTR2,hour_fk_key FROM MTH_ENTITY_SUSTAIN_ASPECT A,FND_LOOKUP_VALUES B
    WHERE B.LOOKUP_TYPE IN ('MTH_USER_DEFINED_ENTITIES', 'MTH_OTHER_ENTITY_TYPE')
    AND B.LANGUAGE = USERENV('LANG')
    AND UPPER(A.ENTITY_TYPE)=UPPER(B.LOOKUP_CODE)
    AND METER_CATEGORY ='PRIMARY'
    AND SUSTAIN_ASPECT='ELECTRICITY'
    AND entity_fk_key=1149
    AND hour_fk_key IN(7283,7294,7300,7301,7302,7303,7304,7305,7306,7284,7285,7286,7287,7288,7289,7290,7291,7292,7293,7295,7296,7297,7298,7299)
    )e
    GROUP BY entity_fk_key,entity_type ,hour_fk_key
    this view entity_fk_key and entity_type joins with enity_fk_key and entity_type of entity diemnsion and hour_fk_key joins with hour_pk_key of MV definition.
    I am having entity type,entity name,day,hour,sum(usage_value) in the report
    Thanks a lot for your help

Maybe you are looking for

  • F150 - Dunning Reminder letter with Open Line Items

    Hi to all I have requirement from client. Standard SAP provides Dunning for only Overdue items,  but my client is having the procedure of considering all open items for legal dunning in their legacy system.  They expecting the same in SAP.  Please he

  • How do I put a podcast on a iPod mini?

    OK, back in the old days (this morning) I had an iPod shuffle. Worked great except that about every third time I turned it on I had to hit various volume-up, pause, play, forward, back, off, on, off, on, volume up four times, etc. to get it to start

  • NoSuchMethod Exception

    Hi everybody!   I'm trying to access to a Web Service Model. I've created the model using a local WSDL, imported it, and binded to the controller using the service controller template. But when I execute muy app I get a NoSuchMethod exception: //This

  • Error in displaying the messages

    Hi Kindly give me some suggestions on this problem I am trying to execute the File2File scenarion, when i execute the scenarion the source file gets picked up from the respective location but i am not getting the output file. When i check in Adapter

  • Failed to load database information DLL crdb_p2smapi.dll could not be loade

    Hello, Iam using Crystaldelivery to view mij crystal reports. I have made a report to read in my outlook agenda. The design of the report is made in Crystal report XI release 2. First when we open the viewer you can select the parameters and then com