Adding a formula in a query

Hey Guys,
I am trying to add a formula in my query, i have the asset acquisition value and the accumulated depreciation value in different columns. I want to get column A - column B in column C.
How can i do this?
Thanks,
Zaid

The fields that you want to use in the calculated field will need to be included in the Field Selection list in your query (I don't think you have to include the fields in the query output, but they do need to be available in the Field selection).  
After reading your reply, I realized that I forgot a step... sorry...  After going into the Field Selection, but before creating the local field, you will need to assign short names to the fields you want to use in the calculation.    To assign short names, you'll first need to turn on the short names column, if it's not already displayed.  Select Edit -> Short names -> Switch on/off.  Find the  fields to be used in the calculation.  For each field, enter a unique name in the short name box next to the field.
Once you've assigned short names, you can create the local field.  Use the short names for the fields in the calculation.  And after you've created the local field, be sure to assign it to the query output.
Regards,
Shannon

Similar Messages

  • How to assign current date/time to a formula variable in Query Designer

    How do I assign the current date to a formula variable in Query Designer? I need to use current data in a calculation and just need the date the report was run.
    Thanks

    Hi Philip,
    There is an SAP formula variable to supply the current date in a formula. I think it is 0F_ADAY...install it from business content if you cannot see it in the query designer (formula box, under formula variables) and try using it.
    Hope this helps...

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

  • Fox Formula Variable In Query Designer

    Hi Experts,
    I have created 1 variable in fox formula of type VARV and i want this Variable to show in query designer while creating new Variable so that i can replace the Query Variable With Fox Formula by Using Replacement Path.
    While Creating new variable in Query Designer it is not Showing that Fox Formula variable.
    Because i want to use this in WAD While Executing the Planning Sequence.
    Is there any way we could get That Fox Formula variable in Query Designer.
    Regards
    Girish

    Hi Marc,
    While Creating Variable from Query Using Query Properties it is still not Showing That Variable in Fox Formula.
    And My Requirement was to Replace that Fox Formula Variable With Query Designer Variable.
    Please Suggest any Solution.
    Thanks
    Girish

  • OBIEE - ESSBASE   ERROR - 1200467 - Error executing formula for [MDX query]

    I have an issue on essbase with a query with 50 member filters.
    The environment is OBIEE 11g over ESSBASE 11.1.2 with an ASO cube.
    The user for essbase are with database access filters.
    I have the following issue, OBIEE returns a query that filter 30 members and the query runs ok, but the same query with a 50 member filter returns the following error when i execute it on MAXL :
    MAXL Error
    ERROR - 1200467 - Error executing formula for [MDX query]: status code [1130203] in function [].
    ERROR - 1241101 - Unexpected Essbase error 1200467.
    i paste an example of the query that returns OBIEE
    With
    set [_Account2] as '{Distinct({[Account].[Allocated FTE - Budget]})}'
    set [_Employee0] as '[Employee].members'
    set [_Fund4] as 'Generate([Fund].Generations(2).members, Descendants([Fund].currentmember, [Fund].Generations(4), leaves))'
    set [_Position4] as '{Distinct({[Position].[POS111165], [Position].[POS111166], [Position].[POS111167], [Position].[POS111540], [Position].[POS112331], [Position].[POS113201], [Position].[POS113247], [Position].[POS113248], [Position].[POS113540], [Position].[POS113618], [Position].[POS113954], [Position].[POS114109], [Position].[POS114194], [Position].[POS115224], [Position].[POS115912], [Position].[POS115913], [Position].[POS116727], [Position].[POS117229], [Position].[POS117491], [Position].[POS117587], [Position].[POS117610], [Position].[POS117979], [Position].[POS119456], [Position].[POS121262], [Position].[POS121458], [Position].[POS121698], [Position].[POS123368], [Position].[POS124027], [Position].[POS124028], [Position].[POS124110], [Position].[POS124396], [Position].[POS125623], [Position].[POS125624], [Position].[POS126476], [Position].[POS127960], [Position].[POS129352], [Position].[POS129468], [Position].[POS129494], [Position].[POS129535], [Position].[POS129608], [Position].[POS129679], [Position].[POS129730], [Position].[POS129905], [Position].[POS130010], [Position].[POS130144], [Position].[POS133456], [Position].[POS134943], [Position].[POS135231], [Position].[POS135404], [Position].[POS135734]})}'
    set [_Program3] as 'Generate([Program].Generations(2).members, Descendants([Program].currentmember, [Program].Generations(3), leaves))'
    select
    { [Budget Item]
    } on columns,
    NON EMPTY {crossjoin({[_Account2]},crossjoin({[_Employee0]},crossjoin({[_Fund4]},crossjoin({[_Position4]},{[_Program3]}))))} properties GEN_NUMBER, [Account].[MEMBER_UNIQUE_NAME], [Account].[Memnor], [Program].[MEMBER_UNIQUE_NAME], [Program].[Memnor], [Employee].[MEMBER_UNIQUE_NAME], [Employee].[Memnor], [Fund].[MEMBER_UNIQUE_NAME], [Fund].[Memnor], [Position].[MEMBER_UNIQUE_NAME], [Position].[Memnor] on rows
    from [BCPSASO2.BCPS_ASO]
    any suggestions ?
    Thanks
    Niko
    Edited by: user8367101 on Mar 1, 2011 10:31 AM

    Here it is:
    It is a Windows Server 2003 R2
    Processor 8393 SE
    31.9 GB of RAM
    32-Bit
    How does "memscaling" works?
    I also think that are high but it is the way it was configured before I managed the application. For my DB
    Index Cache setting: 205800
    Index cache current value: 205800
    Data file cache setting: 33768
    Data file cache current: 0
    Data Cache setting: 877273
    Cata cache current: 71540
    Block Size: 65408

  • Supress Result rows of a formula in a query

    Dear SDN's,
    How to supress Result rows of a formula in a query.
    For a particular characteristic we can do easily in a query,but how can we restrict result rows for a particular formula?
    Thanks and Kind Regards,
    Lakshman Kumar G

    Dear Lakshman,
    If u supress Result rows for a characteristic,,,then all the key figures for that characteristic,,,,this supression rules applies..
    and hence for that particular formula, Supress the relavant characteristic..
    It is as simple as that...
    Hope this helps u..
    Best Regards,
    VVenkat..
    Edited by: Venkata Narayana Jakkampudi on Jan 5, 2009 5:07 PM

  • 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

  • Adding  bp balance in following query

    hello sir,
             u given me good solution but we want to add two rows in following query
    1.  business parner closing balance
    2.    checks on account amount.
    select
    DocNum, CardCode, CardName, DocDate, DocDueDate
    from
    OINV
    where
    datediff(dd, DocDueDate, getdate()) >= 0
    and CANCELED = 'N'
    and PaidToDate < DocTotal
    regards ,

    Hi,
    Here's the query with the BP account balance added. I'm not sure what you mean by the 'checks on account amount'. Please clarify.
    select
         T0.DocNum, T0.CardCode, T0.CardName,
         T0.DocDate, T0.DocDueDate, T1.Balance
    from
         OINV T0
         inner join OCRD T1 on T0.CardCode = T1.CardCode
    where
         datediff(dd, T0.DocDueDate, getdate()) >= 0
         and T0.CANCELED = 'N'
         and T0.PaidToDate < T0.DocTotal
    Kind Regards,
    Owen

  • Formula Variables in Query Designer

    Hello All-
    I'm using a formula variable in my report which is of type user exit.  In my FM, I am calculation some Sales Growth Analysis based on some rates from the TCURR table.  In short, I am calulating "FX Rate" for each currency (USD, EUR etc) I have in my cube.
    In the end, my e_t_range table will contain an "FX Rate" for each currency...in many cases the table will hold more than one value.  The problem is that my query dumps if I have more than one value in the e_t_range table.  I've used regular user exits before on Chars and I was allowed to have multiple entried in the e_t_range table.  What is the nature of formula variables?  Is it the case that I can only pass one value to my query with formula variables?

    Hi,
    Once Bex 3.5 query is opened in Bex 7.0, you can't open the same query in Bex 3.5. If you are still able to open the query in Bex 3.5 means you have not opened it in Bex 7.0.
    Please check it while opening a query in Bex 7.0. It would ask you question " Do you want open bex 3.5 query in Bex 7.0?
    Hope it is useful.
    Thanks,
    Ashok

  • Formula Evaluation in Query Designer

    Hi
    In query designer I have Complex formula which is having lot of variables.
    My users are saying some values are incorrect in report output
    Can any one help how can we find the value is calculated in report output for this formula.
    Thanks
    Sudhakar.

    Hi Sudhakar,
    One more way which you can try to find out how the particular Key Figure is been calculated in query designer is as given below:
    1) Go to RSRT
    2) execute your query with option for Query Display As "List"
    3) You will get the query output
    4) In this screen, you will get the button "Key Figure Definition" on the top
    5) Click on this button and there will be a pop up screen to select "Structure Element 1" and "Structure Element 2"
    6) Here for "Structure Element 1" please select the KeyFigure name for which you want to see the calcuation
    7) and click on the "Continue" (Here its blue colored icon)
    8) After this you will get a screen showing KF value that is calculated by query
    9) Drill down the key figure to see "Fixed Fliter" which will show the data selection used to calculate this value. These are nothing but the global filters defined in query
    10) Drill down the KF to see the dynamic filter values i.e. selections with which this KF is restricted in query designer
    With above analysis you can easily trace out how the particular KF is calculated in query designer.
    Regards,
    Geetanjali

  • Can I put formula in a query

    I created an infoset (SQ02) and a query (SQ01).  I want to have a new column that computes for the difference of the forecasted sales and actual sales.  Can I do that in a query?

    Hello John,
    I'm sure it can be done. But you have to take the help of an Abaper to acheive that.
    Go to Transaction code - SQ02 (Change mode of the query you have created). Then click on the <b>Extras Tab</b> and use the <b>Code Tab</b> to write the formula you require.
    <b>REWARD POINTS IF HELPFUL</b>
    Regards
    Sai

  • Formula creation in Query designer

    Hi All
    I want to explain a bit more on my requirement .
    I have supplied qty and ordered qty and i have the difference between both which is called as service level as %. there will always be 100% for some suppliers and lessthan 100% . So i want to count only the 100% suppliers and divide by all the suppliers . so that i can get the perfect order . and the formula is below .
    I need to apply a formula line count with 100% / line count in one of my querys how to do it the qury designer . Can you anybody guide how to do it .
    Thanks in advance . I am sorry if i have posted in the worng fourm .
    thanks

    you must be having an  infobject refering to say supplier say supplier no. ( like customer number).
    STEP 1: create a new CKF ( formula in query designer on right columns panel)
    STEP 2: create a formula variable with reference characteristic as supplier no . replacement path replaced with infobject->attribute value - constant 1.
    STEP 3. you CKF  " NO OF SUPPLIERS"  definition would be as below
    supplier counter .
    STEP 4. identifying 100% suppliers.create a new CKF  " NO OF 100% SUPPLIER " ( formula in query designer on right columns panel).
    it definition would be
    supplier counter * ( ordered qty == supplied qty ).
    where supplier counter is formula variable. this will give total counts of supplier where ordered qty == supplied qty.
    STEP 4.
    divide CKF  " NO OF 100% SUPPLIER " / " NO OF SUPPLIERS"

  • Trouble adding multiple parameters to Command Query

    <p>I am trying to calculate the calendar days each unit is in use.  For each job a unit has a arrival date and a departure date. A unit may work on more than one job in a day, or on 1 job for more then 1 day</p><p>For example the table look like this, if I have unit #10 and it works as follows<br />Unit   Job        Arrival        Departure<br />10        1         Jan 1            Jan 1<br />10        2         Jan 2            Jan 3<br />10        3         Jan 3            Jan 3<br />10        4         Jan 5            Jan 6           <br /><br />And I want my report to show<br />Unit       Days worked<br />10         5<br /><br />So the Unit actually works on 5 days beween Jan 1 and Jan 6.  I am able to write a query to get this information but I am having trouble creating this in Crystal Reports XI.  I have tried adding my query to the report using "add Command" however when I try to replace my hard coded dates with parameters, I am able to add 1 parameter (From Date) but when I add the (To Date) paramater I get an error "Failed to retrieve data from database ORA00911- Invalid Character"  I&#39;m not sure why it doens&#39;t allow me to add the second date parameter.  I don&#39;t know if there is a better wa to do this within Crystal reports itself.</p>

    Please re-post if this is still an issue and please specify versions.

  • Get value of formula variable during query runtime into a text variable

    Hi all,
    I wanna get the value of the formula variables during the query runtime into a text variable.
    My scenario is like this: First I defined a formula variable Z_DATE_3 which is processing by replacement. It will get the day of a characteristcs(Startdate).
    Then I defined a text variable and in the function module related to this text variable, I used the parameter I_T_VAR_RANGE which can store the value of formula variable during the query runtime.So I can read the value from this table in my function module.
    But I have a issue, when I run the query which used the defined text variable, it seems that it doesn't call the corresponding function module. Because I set a breadpoint in hte code and it never reach this breakpoint.
    If I removed the parameter I_T_VAR_RANGE , it can enter the function module.
    So could you please give some advice?
    Is my solution correct or not?
    And what's wrong with the parameter I_T_VAR_RANGE? Did I use it correctly?
    And My code is:
    DATA:  l_s_range_v TYPE rrrangeexit,
                 l_day type sy-datum.
    if i_step <> 2.
    raise no_processing.
    endif.
      READ TABLE i_t_var_range INTO l_s_range_v
         WITH KEY  vnam = 'Z_DATE_3'.
    if sy-subrc = 0.
         l_day = l_s_range_v-low.
    endif.
    Thanks in advance!
    Best regards
    Fanchest

    Hi, Fanchest,
    I'm having just the same issue.  Did you find a solution?
    I wrote a short routine in CMOD to derive the value of a formula variable to a text variable, but it's not working (I don't get any value).  Can you share your solution?
    Thanks in advance,
    LL

Maybe you are looking for