Calculating Age in BEx Query

I want to calculate age of Order based on Order create date. I am having order create date as key figure date in Order cube. Age is calculated at runtime as (Last day of month) - Order create Date. For Example.
If ORder 'A' is created in 10/01/2004 and if query is executed at 12/31/2004 then Query should produce output  as follows:
Order Number        Month    Age
A                   10/2004  31 Days
A                   11/2004  61 Days
A                   12/2004  92 Days
In my infocube I've only one record for this order with Order number and Order create date. How to produce above mentioned o/p from this.
Thanks,
Milind

Hi Milind,
if you are looking for a web solution, use a table interface to create a new column for the age. You can calculate the value for the order age with the table interface, too. An advantage of this table interface solution is, that you can concatenate your unit [days] into the output range, like "31 Days".
For BEx Analyzer, you can create a VBA macro to get the same advantage...
rgds Jens

Similar Messages

  • 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

  • Calculated Keyfigures Fromm Bex Query into BO without Unit

    Hello,
    We built a Universe on top of Inventory Query from Bex Query Designer. We have Calculated Key figures defined on both Restricted Key Figures and also just as the sum of one or more InfoObjects.
    In the Universe some Standard Keyfigures based off of InfoObjects are shown as folders with Unit value, but the Calculated Key Figures are simply shown as a Measure - it does not have a folder associated that gives the Unit of Measure.
    If we run the same Query from Bex Analyzer all the Calculated Keyfigures have units associated with them.
    Can you please let me know if any of you have the same issue.
    Thank you,
    Jennifer

    Ingo,
    We are using Business Objects 3.1
    Example:  The universe is built off of a Bex Query that is going against the standard MultiProvider 0IC_MP04.  The query has as part of the key figures the following:
    Standard InfoObjects:  0VALSTCKQTY (valuated stock qty) and 0TRANSSTOCK (Stock in Transit)
    Calculated Key Figure:  CKF_INV_QUANTITY.  This key figure is defined as 0VALSTCKQTY + 0TRANSSTOCK.
    When I look at the Key Figures for the universe that sits on top of this query, the two standard InfoObjects have a folder that contains:  1)  Valuated stock quantity (as a measure) 2) Valuated stock qty Unit (as a dimension) and 3) Valuated Stock qty Formatted (as a dimension).  The Stock in Transit is treated the same way.
    However, for the calculated key figure, CKF_INV_QUANTITY, I only see the measure that pertains to the sum of the two fields.  I do not have a unit associated with that value.
    Thanks,
    Jennifer

  • How to calculate Age in BEx query

    Hi,
    I need to calculate age in years based on person's date of birth and the key date that user of the report will enter.
    So, basically in my query I already have date of birth characteristic from 0PERSON InfoObject. I created ZAGE key figure and added it to the query that I would like to populate with person's age.
    So I know I have to enter some code in CMOD for calculated key figure ZAGE to get calculated based on birthdate and key date that user enters. Can somebody help with the code?
    thanks

    Hi,
    The variable should be in "Date" dimension. I have missed one important information in earlier mail.
    The processing type of the variable (user entry date) should be of "Customer Exit' and dimension (in last tab) should be "Date".
    By selecting this dimension, the variable input help screen also appears in calendar format to help user to select date instead of writing it in variable input.
    No need to write any custom code for this variable. We are selecting the "Customer exit" processing type to get Date dimension. In Normal user entry variables we can't get date & time dimension.
    "Ready for Input" should be selected so that user can enter date.
    I hope you can solve your issue now.
    Thanks for your feedback.
    Regards,
    Arun Thangaraj.
    Edited by: Arun  Thangaraj on Oct 8, 2008 8:48 AM

  • Performing ranking calculations with the BEx Query Designer - ideas?

    I have a scenario where I have a key figure with raw values.  In the column beside this I want to rank the key figures by their raw values.
    Something like this:
    Amount      Rank
       0.11           2
       0.05           3
       0.22           1
       0.03           4
    I can do this no problem using the "Calculate Single Values as:" Ranked List.
    For subsequent calculations I need to perform mathematical operations on the RANK column.    For example say I want to make a 3rd column where I divide the rank by 2:
    Amount      Rank     Rank by 2
       0.11           2             1
       0.05           3            1.5
       0.22           1            0.5
       0.03           4             2
    I cannot figure out how to do this as SAP does not really STORE the values of the rank column for my next calculation.  The "Rank by 2" column actually shows this:
    Rank by 2
        0.065
        0.0025
         0.11
        0.015
    which is dividing the original amount by 2 and not the actual RANK value.
    Anyone have some suggestions on what I can do?

    I know what you are talking about, it will always return 1 or zero which is true or false, I don't think you can do anything much to this. Since, the value of Ranked is getting calculated at runtime.
    thanks.
    Wond

  • Aging In Bex

    Hi All
    I have calculated aging in Bex using formula variable. It is working fine but i observed that the characteristic expire date has to be part of the query for the age to be calculated. Even if it is in free characteristic it doesnot calculate age, it has to be in Rows. Now the problem is that i require an aggregate (average) number of days for particular region and country.
    This is not happening if i donot want to include the expire date in rows. Can anyone please suggest a solution to this ?
    Regards

    Hi
    Cell editor is not working. I will elaborate on the variables a bit for better understanding
    I have 2 variables
    1) replacement variable for expire date
    2) customer exit variable for current dae
    I have created a formula to subtract current date and expire date to get age.
    Now the replacement path variab;e is populated only when the original characteristic is part of ROW else it is showing 'X'.
    Need to know if there is any way to avoid this? or is there some other method to perform the same.
    Regards
    Preethi

  • Calculated Key Figures Corrupted in a BEX Query

    Hello SDN's,
    We are facing an weird issue in BEX Query. As part of Enhancing the query, We have created a new CKF and added in the Columns for the required CKF. It prompted for a Transport request and saved the Query elements for more than hour. Now the Query is throwing an Error messages where in more than some 30 CKF's got corrupted. When i check the CKF definition for all the corrupted key figures there is not Formula or Calculation.
    Below is the message which we can see in the BEX query for Corrupted Calculate Key Figure.
    Diagnosis
    Element ' XXX ' cannot be analyzed by the analytic engine without a definition.
    System Response
    Without a valid definition, the element will be ignored by the analytic engine.
    Procedure
    Provide a valid definition for element 'XXX'.
    Could anyone please help me to retrieve query back to normal ???. Your are inputs are appreciated
    Thanks,
    HA

    yo could try rsrt in bw and try to regenrate the query thats all i got. .otherwise always make a copy before you start working on a query. if it still is coruupted then you will have to recrate it. if the query is in your bwq maybe the basis can do a transport( not recomended)back. good luck..

  • Bex Query - Specific calculation in query result

    Hi experts!
    I've received a requirement and I cannot find any way to delivery it using the stantard operation or configuration into Bex Query.
    We have a query which have three KF with summarization in result. The new requirement is based in the KF "POND" to change the calculation in the result. Below are the actual result and the expected result.
    The actual query result.
    Line
    OP
    QTD
    TMP
    POND
    A1
    1614073
    702
    19
    13338
    Total A
    702
    19
    13338
    B1
    1587949
    840
    235
    197400
    B2
    1610938
    4.240
    28
    118720
    Total B
    5.080
    263
    316120
    Total A + B
    5.782
    282
    329458
    The expect result based on the new requerment
    Linha
    Ordem de Produção
    QTD
    TMP
    POND
    A1
    1614073
    702
    19
    13338
    Total A
    702
    19
    19
    B1
    1587949
    840
    235
    197400
    B2
    1610938
    4.240
    28
    118720
    Total B
    5.080
    263
    62
    TOTAL A + B
    5.782
    282
    57
    Check out the "Total A" result for KF "POND", the new calculation is the sum of KF "POND" divided by the sum of KF "QTD" (13338 / 702 = 19)
    The same to "Total B" result for KF "POND", the calculation is the sum of "POND" divided by sum of KF "QTD" ( (197400 + 118720) / (840 + 4240) = 62).
    I've been using all recourses into Bex query, but I've haven't found any way to deliver this requirement, though.
    I'd really appreciate if anyone could give me some suggestion to deliver this requirement.
    Thank you.
    César Sevilha.

    Hi Suman!
    Thanks for your replay.
    The collision options wont help me because I have calculation on the same structure.
    I need to keep the division POND by QTD in the result. Check out the table below.
    The Formula Bex Query (POND / QTD) is a simple division between  KF POND by KF QTD, the result
    is a totalization of lines A and B.
    The requirement is to keep this division on the result. Check out the column Requirement, this is the result expected.
      Line
      OP
      QTD
      POND
    Formula
    Bex Query (POND / QTD)
    Requirement
    A1
    1614073
    702 KG
    13.338 KG
    19 KG
    19 KG
    Total A
    Result
    702 KG
    13.338 KG
    19 KG
    19 KG
    result (POND) divided by result (QTD)
    B1
    1587949
    848 KG
    197.400 KG
    233 KG
    233 KG
    B2
    1610938
    4.318 KG
    118.720 KG
    27 KG
    27 KG
    Total B
    Result
    5.167 KG
    316.120 KG
    260 KG
    61 KG
    result (POND) divided by result (QTD)
    Total A + B
    Result
    5.869 KG
    329.458 KG
    279 KG
    56 KG
    result (POND) divided by result (QTD)
    I'd like to know how to keep the division in the result.
    Example:
    The result of Total B should be 61 kg which is the result of division between the result of KF POND (316.120) by the result of QTD (5167).The currently formula has as result the totalization  of B1 and B2.
    Thank you in advance.
    César Sevilha.

  • Calculated Age and Age Ranges in a Query

    Hello,
    We are using 3.5 Query Designer.
    I am trying to create age ranges in a query. The InfoProvider at this point (I've gone very simple) is InfoObject, 0PERSON.
    I've created a calculated key figure (CKF) called age which I have used a formula to define. The age is calculating correctly. Age has  'Calculate Result As...' = Summation. And in the 'Enhance', 'Time of Calculation' is set to Before aggregation. Number of decimal places set to 0. Now I've created a CKF, AGE_GE_40 which has as its formula 'COUNT(('Age' >= 40)). I've created an additional CKF, AGE_LE_39 which has a formula 'COUNT(('Age'<=39))'. Both of these have the 'Summation' set in the calculation section. The query contains 0GENDER, 0PERSON with AGE_GE_40 and AGE_LE_39 and Number of records as the key figures in the columns. When executed initially, all of the result rows are correct. The problem is when I remove 0PERSON, the result rows only give me 1 per gender. This seems like an easy thing to do, why is it not working?
    Thanks for any help,
    Diane Merrill

    Diane,
    For each row in the query data, there is only one age value calculated, which is the aggregration of all records which fulfills the row's characteristic value combination. Thus, when there is Gender & Person columns in the query, each row calculates an age value for the Gender/Person combination, which is essentially the same as for each person, because each person has one gender value. However, when you remove person from the columns, there will be only two values for gender, and the age is calculated as the sum of ages for all records with the same gender value. To reveal more on this, you can add the Age key figure into the query columns, and run the query with only the gender (i.e. without person). Once you see the age value for each row, it should be clear to you.
    Please reward points if this is helpful.
    Wayne

  • Bex Query- Use of ABAP code in Calculated Keyfigure/formula

    Dear Experts.
    I am wondering if there is any way to use ABAP in the formula editor of the Bex Query desinger.
    I have to build a report with very complex formulas (a lot of key figures, comporations, If then else ) an I think it would be easier to build all then in ABAP.
    So what I am looking for is any kind of user-exit/Badi that allows to calculate a Calculated Key figure/fomula in ABAP with the same data that is availabe in the fomula editor.
    If SAP is not providing this, this is clearlly a must for next releases.
    Thanks a lot and best regards,
    Alfonso.

    Dear Ananda.
    Thnaks for your reply, but could you please extend your answer a little bit more?
    As far as I know, Formula customer exit variables are only called once and they don´t provide the rest of the keyfigures and characteristic use in the drilldown level, so for my needs they are useless.
    Regarding IF-then-else statement in the formula, I already know about it. Actually what I am trying to avoid is to use them. In order to build my query I might need to build really big formulas with a lot of If-then-else, making it quite complex what the formula is doing. This is the reson I want to do it on ABAP.
    Please any other ideas?
    Thanks a lot.

  • Count and Percentile calculations for various Lines in BEx Query.

    Dear Experts
    I working on a BEx Query at the moment and the output is required in the format below:
    This and another report (which will be displayed above this report) will go into a WAD eventually.
    I have Key Figure for 'Document Count' but not sure how to get the percentage displayed in the second line and also for the Top 3 Reason Codes (not having anything displayed across 'Top 3 Reason Codes' though). I have tried Selection and other ways but nothing worked so far.
    Do I have to use Cell Editing by any chance or is there a way to work-around this.
    Thanks in advance for your help.
    Kind regards,
    Chandu

    You can achieve your report format by creating a Structure in rows with Cell definitions. Define each cell in COunt Document KF according to the row logic.

  • Bex Query: make data pass through user exit calculation at navigation time

    Hi all!
    I have a new requirement and I don't know how to solve it...
    Now, when I execute a web model containing a query, the system "reads" a date and calculate the query based on that date in a user exit defined in CMOD, for example, filtering data with an interval between january and the date read.
    Besides, I have in the web model a dropdown item where user can choose other months. The dropdown item only shows single values but now if I choose a month, the query only shows data for that month.
    I need the system filters the query with the new interval. For example, between january and the new month the user has just chosen.
    Does anyone know a way to make a query pass through the user exit calculation after executing the query for the first time? Any other ideas? I need the query to "reexecute" and filter the data (create a new interval) based on the value a user chose.
    (sorry about any inconvenience, because I posted the problem in another sdn specific forum but as I received no answer I've decide to explain it in here...)
    Thank you! Points will be assigned.

    Any ideas please?

  • Headcount Calculation in WebI via BEx Query

    Hi All,
    My WebI report is through the BEx Query.
    For the headcount data to be shown in report the value is comming rite for month i.e., 900 but when for year count it is showing as 500. but technically for headcount the value should populate as "900" again.
    The formula i used was (count distinct employee).
    The cube used here is standard bw headcount cube.
    Please let me know about any work around for this.
    Thanks,
    Vijay

    Hey Carly,
    thanks for your suggestion.
    I actually search for notes, but found non relevant for our system. The BW notes can actually be implemented as there is an "embedded" BW server, but it's release seems to be high enough.
    I don't think the query is "hanging". The "loading" popup stops after a few minutes and then simply shows the "empty" entry with an updated timestamp under BEx documents. We don't receive any errors.
    Not too familiar with "tracing" within BO, but I'll give it a try (after doing some research and consulting some (ex-)colleagues). I have asked to "update" our front end tools too, as we're rather "low" (and have some Dashboard issues as well). So, since it's already (late) Friday afternoon here, I might just wait on that update (almost time to start my weekend).
    Cheers,
    Raf

  • Division in bex query designer

    Hi experts,
    I have a strange problem in bex query designer. I am trying to calculate margin in % but the calculation gives the wrong result.
    The two figures I try to calculate are -25124 and -91248 (figures in 1000 NOK)
    The result should be (-25124/-91248)100 = 27,53* (when formula entered in excel)
    I have tried the following in Bex query designer
    -25124 %A -91248 = -0,02753%
    (-25124/-91248)*100 = 0,02753
    What might be the problem here?

    Thanks again for your answer,
    I will try to explain my report (requirement from the business user)
    Actual (KF)----
    Budget (KF)       
    Sales-- -91248--
    -77153         
    FSP-- -25124--
    -18918
    Margin  % -
    (FSP Actual/Sales Actual) 100---(FSP Budget/Sales Budget)100
    Dim
    Dim
    Result
    The margin is calculated in the cells in the bex query designer to differentiate between actual and budget. There is no option to calculate the margin in the columns as this would influence all other rows aswell.

  • % Calculactions in Bex Query Designer

    Hi Experts,
    Could you please on how can i perform the below % Calculactions in Bex Query Designer.
        Vendor No line item Not = L category =A  status =RFQ :for items
    Example : I have 8 items for vendorNo 200274 and only 4 as above condition and 5 items as not L(delete)
    requament: % RFQ Without Response:
    Percentage of Quotation response ={(No. of RFQReponses Received/ No. of RFQ items sent)*100},
                                                                   ( 4/5 * 100= 80%)
    Percentage RFQ without response= 100 -  Percentage of Quotation response
                                                                  =  100-80 = 20%
    How can i perform the % Calculations in Bex Query Designer.
    Vendor
    Purchasing document
    Indicator: Line Item
    Purch. doc. category
    Purch. doc. status
    Item
    Number of Records
    category A item L
    200274
    V-LINE EUROPE EXPORT MARKETING
    6000003778
    L
    A
    Not assigned
    10
    1
    20
    1
    30
    1
    6000003779
    Not assigned
    A
    Not assigned
    40
    1
    9000000046
    Not assigned
    A
    RFQ
    10
    1
    1
    20
    1
    1
    30
    1
    1
    40
    1
    1
    Result
    8
    4
    thank you

    Hope you have done some groundwork you have done on this requirement. Have you tried to create New Formula and put the required formula in it to calculate Percentage of Quotation response ?
    Your formulas seems to be straight forward.
    Keep in Filter: item Not = L category =A  status =RFQ
    You may start working on it and get back with if you are struck.

Maybe you are looking for

  • How do I hide the artist picture in ios 7 music player?

    I like the artist and album "list view" in the ios 6 music player much better than the view that includes a random picture on ios 7.  How do I hide the picture and get my list view back?

  • Can I install internal HD from PowerMac G4 in my Mac Pro?

    I have an old, Quicksilver PowerMac G4.  After purchasing a Mac Pro, I want to use the internal storage from the old one as a backup system for the new one.  Can I physically install the my 3 internal drives from the G4 into the 3 open slots on my Ma

  • My airport won't connect right away; I have to turn it off first for it to connect

    When I'm connected to the WiFi at my house and then connect to WiFi somewhere else it says it's connected but doesn't work and I have to turn off the Airport first and then turn it on again for it to really connect.    

  • Exclude Purchase Requisition as a source of requirement

    Hi All, Please help me to configure the scenario. Sales order is created - Plant A, Sales Org u2013 A. (Item category u2013 BANC, Plant B is created as a vendor for Stock Transfer Purchase Order) Production Happens in - Plant B Present scenario u2013

  • Tab opens by itself!

    Sometimes - but not always - when I open Safari, a second tab opens by itself and displays the evernote website. Why might this be?? I think you can set up multiple home pages, but I haven't done that.