Skip to Content
author's profile photo Former Member
Former Member

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 03, 2005 at 07:35 AM

    Hi Milind,

    create a customer exit formula variable which will return the last day of month. Then you can create a formula by subtracting the order create date from your formula variable.

    Heike

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      I don't think that Heike's solution works here because you need to calculate the value depending on the month.

      I'd do the following:

      Create an attribute LASTDAY (as key figure) for 0CALMONTH.

      Create a formula variable with replacement path that is replaced by LASTDAY.

      You can use this variable for calculation.

      Best regards

      Dirk

  • author's profile photo Former Member
    Former Member
    Posted on Jan 03, 2005 at 09:18 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.