Use difference between 2 dates in calculation

Hello,
I want to create a calculation that compares between each month in the year of the forecast and 'Hire Date', so if our year starts in jan-2011. I want to get the difference between jan-2011 and hire date, next month it should get difference between feb-2011 and hire date and so on. The calculation below is trying to check if the difference is more than or equal 1 year.
I have an account named 'Hire Date' of Date type.
I'm trying to write a calculation as follows:
@DateDiff("Hire date",*Current_Date*",DP_Year) >=1)
I need the "Current Date" to contain the full formated date as hire date. I was thinking of producing the current date for example: 01-Jan-2010 to be used in the calculation as follows:
IF(@DateDiff("Hire date",(@CONCATENATE("01",@CONCATENATE(@CURRMBR("PERIOD"),(@CONCATENATE("-",@CURRMBR("YEAR"))))),DP_Year) >=1)
a=b*c;
end if;
Am I on the right track or there's any straight function function or method that can return the current month-year being proccessed in the calculation and use it directly in datediff calculation? or there's any method other than datediff to perform the same ?
Thank you.

I know that it takes date as input parameters, and this is what I was trying from the beginning until my last message that I was pretty sure I'm using it correctly but its not working correctly and returns zero, I started wondering if it's not working with members of date type!, and actually it came to be true as per Oracle support confirmation below! :
"Oracle Support - March 1, 2011 5:06:21 PM GMT+02:00 [ODM Research]
Issue is related to enhancement request
Bug 9576187 - PLN SHOULD SAVE DATES AS ESSBASE DATE SO DATE FUNCTIONS CAN BE LEVERAGED IN HBRS
Oracle Support - March 1, 2011 5:12:12 PM GMT+02:00 [ODM Question]
The Essbase function "@DateDiff" is not returning the expected result when used with Planning date members.
Oracle Support - March 1, 2011 5:16:42 PM GMT+02:00 [ODM Answer]
Essbase saves dates as a number representing the seconds elapsed since midnight, January 1, 1970 (POSIX format). However, Planning saves the dates as a 6-digit number.
Since all native Essbase date functionalities (@DATEDIFF, @DATEDIFF, @DATEPART etc.) require their date parameters in the POSIX format, Planning dates cannot be processed with Calculation Scripts and Business Rules.
There is currently an enhancement request pending which aims to address this issue. However, currently there is no indication of whether this enhancement is going to be incorporated into a future release.
Enhancement Request:
BUG 9576187 - PLN SHOULD SAVE DATES AS ESSBASE DATE SO DATE FUNCTIONS CAN BE LEVERAGED IN HBRS
Oracle Support - March 1, 2011 5:26:45 PM GMT+02:00 [ODM Action Plan]
Unfortunately, the Essbase date functions (@DATEDIFF, @DATEDIFF, @DATEPART etc.) are not supposed to work with Planning members of type date. There is currently an enhancement pending. I will follow up this enhancement request to get clarification on whether it's actually considered for future releases.
I will keep you updated.
Oracle Support - March 2, 2011 10:32:20 AM GMT+02:00 [ODM Action Plan]
With Oracle EPM 11, those new date functionalities have been introduced to Essbase. As previously outline, any date function in Essbase expect the date to be in the POSIX format but Planning's date form consists of 6-digit number. Hyperion Planning and Essbase are two independent products which are available as part of one suite. Although Hyperion Planning requires Essbase, it does not necessarily support every functionality available in Essbase. A couple of years back, when Hyperion Planning's date format was definded, it didn't use Essbase. Unfortunately at the time, Planning development decided to use a 6-digit number rather than the POSIX format. During the past couple of years, efforts have been made to "sync" Planning and Essbase to provide a seemliness experience. The mentioned enhancement request serves the purpose to make it possible to use the Essbase date functions against Planning date members.
Please understand that this issue is not a technical problem as such. Any suggestions concerning a possible approach in order to achieve a date comparison falls into the scope of functional consultancy. The only possible workaround I can see, is to write a rule which follows the same logic as a POSIX date converter in order to be able to use the resulting date values in conjunction with the Essbase date functions as well as to be able to save the corresponding date value in a 6-digit format to Planning date members."

Similar Messages

  • [Urgent] Need help calculating difference between two dates

    I'm trying to write a code to display the current day and time, then accept two dates from the user and display the difference between the two dates. To display the current date and time, I've used the SimpleDateFormatter library but I'm having difficulty calculating the difference between two dates. Could someone please help me with this?
    Below is my code so far
    import java.util.Date;
    import java.util.Scanner;
    import java.text.SimpleDateFormat;
    public class DateFormatter {
         public void displayNow()
              Date todaysDate = new Date();
              SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MMM-dd HH:mm:ss");
              String formattedDate = formatter.format(todaysDate);
              System.out.println("Today's date and time is: "+formattedDate);
         public void calculateDifference(Date startDate, Date endDate)
              /* This is whre i need help! */
         public static void main(String[] args)
              DateFormatter df = new DateFormatter();
              Scanner sc = new Scanner(System.in);
              df.displayNow();
              System.out.println("Please enter a date: ");
              String date1 = sc.next();
              System.out.println("Please enter another date: ");
              String date2 = sc.next();
    }The methods displayNow() and calculateDifference(Date startDate, Date endDate) are essential and cannot be skipped out.

    tarahmarie101 wrote:
    Dude. I've tried doing assignments under pressure, and it doesn't work. Here's a piece of free advice. Start earlier next time, don't put "urgent" in the title of your post b/c it just pisses people off around here--and is a sure sign of an overdue homework assignment which no one around here likes helping with, and try to ask intelligent questions--don't just say "Help me!"
    Of course, it takes some time to learn what the intelligent questions are. You have my sympathy. Try asking questions about how to do a particular task, instead of asking people to tell you what to do. It starts to get easier after a while.
    actually dude i started on this on monday.. but there were so many other stuff to do along with this.. and i did try referring up the Calendar utility but it was a bit confusing actually.. it was only after that did i come to this forum.. nor am i very good at Java.. anyhoo thanks for your sympathies :P

  • Calculating the difference between 2 dates that ristrict 0CALDAY

    Hello.
    Is there an oppotunity to calculate the difference between 2 dates, that restrict the characteristic 0CALDAY.
    If i make the formula with
    1. type - replacement path
    2. interval use - difference
    than the difference could be calculated wrong(example 20070301 and 20070101 - result 201)
    Is there another way do solve the problem?
    Best regards,
    Andrey

    Hi,
    as you said, you need to create 2 formula variables.Both of them should have Replacement path as the preocessing type. And then use a formula to do the difference above 2 formula varibles.
    Now check these settings for both variables:
    <b>Replacement Path</b>
    Replace Variable with: <b>Key</b>
    For Intervals Use: <b>From Value</b>
    <b>Currencies and Units</b>
    Dimension ID: <b>Date</b>
    Then it should work
    Another link:
    http://help.sap.com/saphelp_nw04s/helpdata/en/03/6ba03cc24efd1de10000000a114084/frameset.htm
    regards
    marc
    assign points if it helped

  • Difference between two dates, using Variables in reporting

    how to calculate the days difference between Delivery date and Billing date in reporting, using variables (SAP BW 3.5v)?

    Hi,
    If you want to do the arethmatioc operations with the date then you will have to declare the date as key figure in the cube and add it there and then update it with the date from R/3.
    You can use formula variable for this subtraction.
    Create a formula in the bex analyzer and then in the down you will get option for the formula varibale.Just make a replacement path varibale on this time characteristic for which yuou want subtraction.
    During creation use "key" in the display and "number" as the data type.
    If number is not working them you can use "date" type.
    Nothing alse needs to be done during the variable creation.
    Once you have made the formula inlcude it in the columns of the report.
    Thanks

  • Calculating the difference between to dates.

    All,
    I've a requirement where I need to calculate difference between to dates. If the given date is less than the current date, it should return '0'(zero) other wise should return 1. How can i do this?
    Regards,
    Venky

    SQL> select decode(sign(sysdate-to_date('01/02/2008','DD/MM/YYYY')),1,0,1) as datecomp
      2  from dual;
      DATECOMP
             0
    SQL> ed
    Wrote file afiedt.buf
      1  select decode(sign(sysdate-to_date('01/12/2008','DD/MM/YYYY')),1,0,1) as datecomp
      2* from dual
    SQL> /
      DATECOMP
             1
    SQL> ed
    Wrote file afiedt.buf
      1  select decode(sign(sysdate-to_date('11/11/2008','DD/MM/YYYY')),1,0,1) as datecomp
      2* from dual
    SQL> /
      DATECOMP
             0
    SQL>Edited by: BluShadow on Nov 11, 2008 1:27 PM
    couple of further examples.

  • Difference between Posting Date & Baseline date in MIRO

    HI,
    What is the difference between Posting Date & Baseline date in MIRO?
    Regards
    Chandan
    Edited by: Chandan H N on Dec 14, 2009 11:11 AM

    Dear,
    Posting Date:
    Posting Date in the Document
    Date which is used when entering the document in Financial Accounting or Controlling.
    Use
    The fiscal year and the period for which an update of the accounts specified in the document or cost elements is made, are derived from the posting date.
    When entering documents, the system checks whether the posting date entered is allowed by means of the posting period permitted.
    Note
    The posting date can differ from both the entry date (day of entry into the system) and the document date (day of creation of the original document).
    Baseline Date
    Baseline Date for Due Date Calculation
    Date to which the periods for the cash discount deadline and the due date for net payment refer. This is the case for line items in open item accounts.
    For line items in G/L accounts, the item is due immediately on this date because there are no cash discount specifications.
    Procedure
    During document entry for open item accounts, the date may be defaulted. For this, a terms of payment key must have been specified in the customer's/vendor's master record for which a default value is requested in the document.
    The proposed date can be overwritten.
    If the cash discount rates (and days) have not been entered, the baseline date for payment is the same as the due date.
    Regards
    Utsav

  • Difference between two date in bex query

    Hi all,
    I need to do a difference between two date using formula variable processing type customer exit beaucause I must use factory calendar in the formula.
    How can I do it?
    Can you give me an example of the routine?
    Thanks a lot
    Gianmarco

    Hi,
    You can still use the same code to copy it and customize as per your need. All you need to do is to subract the dates using the class: CL_ABAP_TSTMP after converting to timestamp and resulting seconds you convert back to days....Please get help from the developers to do this...
    Also, ensure that you write back this difference value to your variable so you get it on the reports for your calculations...
    Cheers,
    Emmanuel.

  • Difference between two dates

    Hi
    I have two date fields in the ODS..Both are characterists
    1. Requested delivery date
    2. Actual shipment end date.
    I would like to create a calculated KF  field for the difference between two dates in a query.
    How can I accomplish it?
    Regards

    You have to make Expiration data as nav attribute and create a formula variable then only this date can be used in calculations.
    refer this How to...for the same
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/72f4a790-0201-0010-5b89-a42a32223ffc
    later you can try to calculate difference between dates!
    Re: calculating the difference between two dates
    Please search in forum with 'difference between two dates'.You will find lots of good posts on this issue!
    hope this helps
    Regards

  • Calculate the difference between Creation date and key date

    Hello
    I want to calculate the difference between creation date of the document with key date(todays date). How can i do that in the query designer. Also then I want to restrict my key figure on this difference if it is =10..please can someone suggest what can be done
    thanks

    Hi Grame...
    For the days calculation ..
    I suggest you to use replacement path ..
    I have the reference that you can see the sample. The case of samples is also about day calculation.
    http://www.sd-solutions.com/documents/SDS_BW_Replacement%20Path%20Variables.html
    Hopefully it can help you a lot.
    Regards,
    Niel.

  • Difference between two dates in seconds/milliseconds with Expressions

    Hi,
    I need to write a query using Expression(Builder) which calculates the difference between two columns (date/timestamps). As of other requirements I am not able to use JPQL, so I tried to create the query with the Expression framework. The difference between the two dates can be calculated with the
    ExpressionMath.substract(...)
    method. The result is a Date-like object storing the difference between both dates. But how can I cast this difference to a long or something like this with expressions?
    Thanks,
    Thomas

    Date functions are very database dependent, as each database has its own set of functions for processing dates.
    The functions are defined in the Expression class, you can try,
    truncateDate, roundDate, or datePart
    http://www.eclipse.org/eclipselink/api/1.1.2/org/eclipse/persistence/expressions/Expression.html#truncateDate(java.lang.String)
    http://www.eclipse.org/eclipselink/api/1.1.2/org/eclipse/persistence/expressions/Expression.html#roundDate(java.lang.Object)
    http://www.eclipse.org/eclipselink/api/1.1.2/org/eclipse/persistence/expressions/Expression.html#datePart(java.lang.String)
    James : http://www.eclipselink.org

  • As to the data type of the data type of the difference between two date type of datas

    Hi,
    I have a question about the data type of the difference between two date type of datas.
    There are two date type of datas as:
    SSHIPMENTS.RECEIVEDATETIME
    SSHIPMENTS.PROMISEDATETIME
    I try to use the following SQL Script in Oracle SQL*Plus as:
    SELECT CASE
    WHEN (SSHIPMENTS.RECEIVEDATETIME - SSHIPMENTS.PROMISEDATETIME) < '000 01:00:00.000' THEN 'OnTime'
    WHEN (SSHIPMENTS.RECEIVEDATETIME - SSHIPMENTS.PROMISEDATETIME) < '000 01:30:00.000' THEN '60-89 Minutes'
    ELSE '3+ Hours'
    END
    FROM SSHIPMENTS;
    The error message of "Invalid Number" for the '000 01:30:00.000' happens.
    I don't know if the data type of the interval is wrong.
    Many Thanks,
    Cathy

    SELECT CASE
    WHEN (to_char(SSHIPMENTS.RECEIVEDATETIME,'hhmiss') - to_char(SSHIPMENTS.PROMISEDATETIME,'hh24miss')) < '010000' THEN 'OnTime'
    WHEN (to_char(SSHIPMENTS.RECEIVEDATETIME,'hhmiss') - to_char(SSHIPMENTS.PROMISEDATETIME,'hh24miss'))< '000 01:30:00.000' THEN '60-89 Minutes'
    ELSE '3+ Hours'
    END
    FROM SSHIPMENTS;
    just try it out..

  • Difference between doc date,posting date and invoice date

    hi bw guys
    can someone give a brief on the difference between doc date,posting date and invoice date.and the invidual definitions
    thank you

    Hi,
    Posting Date: Date which is used when entering the document in Financial Accounting or Controlling. The posting date can differ from both the entry date and the doc date.
    Document Date: The document date is the date on which the original document was issued. Ex: Inv date, Bill date etc.,
    Invoice Date : Usually the date when goods are shipped. Payment dates are set relative to the invoice date.
    -Vikram

  • Code to genereate difference between succcessive dates in a table

    First create and Insert statements;
    create table schedule(iloan_code number , schedule_date date);
    insert into schedule values(1001, to_date('01-jun-2012'));
    insert into schedule values(1001, to_date('01-jul-2012'));
    insert into schedule values(1001, to_date('01-aug-2012'));
    insert into schedule values(1001, to_date('01-sep-2012'));
    insert into schedule values(1001, to_date('01-oct-2012'));
    commit;THe output of the SCHEDULE table shall be now like this:
    ILOAN_CODE     SCHEDULE_DATE
    1001              01-JUN-12
    1001              01-JUL-12
    1001              01-AUG-12
    1001              01-SEP-12
    1001              01-OCT-12we want an extra column by name DAYS along with the existing columns which would be the difference between the dates.
    First row should be the difference between sysdate and the date 01-jun-2012 and the successive rows must be the difference between successive schedule dates
    For instance in the second row the DAYS column must represent the difference between 01-jul-2012 and 01-jun-2012 and so on for the next rows too.
    We need to get the output through a SELECT statement
    The output of the SCHEDULE table must be somthing like this.
    iloan_code      schedule_date     days     Logic which we need
    1001     1-Jun-12     22     sysdate-1st June 2012
    1001     1-Jul-12     30     difference between 1st July 2012 and 1st June 2012
    1001     1-Aug-12     31     difference between 1st aug 2012  and 1st July 2012
    1001     1-Sep-12     31     difference between 1st sep  2012 and 1st aug  2012
    1001     1-Oct-12     30     difference between 1st oct 2012 and 1st sep 2012Please advise;

    Hi,
    sri wrote:
    ... Could you please let me know the formatting procedure used for the output . I have used (code) (code) (you can consider ( for { ) concept but could not display the
    expected results properly.I'm not sure what you're saying.
    To preserve spacing, type these 6 characters:
    \(small letters only, inside curly brackets) before and after each section of formatted text.
    Alternatively, you can use these 6 characters
    &#091;code&#093;
    (case insensitive, inside square brackets) at the beginning of a formatted section, and these 7 characters
    &#091;/code&#093;
    (with a forward /) at the end of the formatted section.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Calculate the Difference Between two dates excluding weekends and Holidays

    Hi,
    We need to calculate the difference between the two dates by excluding the Local public holidays (It is global and varies across countries) and weekends should not be included in calculation for a business day in OBIEE.
    We have two dates: Open date and close date when ever close date is null we are calculating age based on taking the current timestamp and need to exclude the weekends and Holidays when ever the close date is null.
    Ex:
    Col1 col2 Total
    11/9/2010 2:46:38 PM Null 13
    11/2/2010 8:06:26 PM 11/3/2010 5:37:03 PM 1
    (In the Total we shouldn't include the weekends,holidays)
    Please let me know how to calculate the difference between two dates by excluding the weekends and holidays.
    Thanks
    Edited by: user10441472 on Nov 22, 2010 3:14 PM

    You already asked this question and I answered it...
    Re: calculation of Business day in OBIEE

  • How to calculate the Time difference between 2 dates

    HI All,
    I am using HR_hk_diff_btw_2_dates to calculate the employee service dates.
    For that i  am inputing his hire date and Term dates and Output format as '05' i am getting output perfectly....
    But problem is  whe i am inputting the employee hire date is Dec 1 2007 and Term date is
    March 31 2009 It is coming as 1 year 3 months  31 days instead of 1 year 4 months directly .......How could we make it make last date also working day and get the O/p as 1 year 4 months ?Please Advice..
    Regard
    sas

    1. FM for difference betwwen two times:SCOV_TIME_DIFF
    Import parameters               Value
    IM_DATE1                        2008-01-01
    IM_DATE2                        2008-01-01
    IM_TIME1                        10:00:00
    IM_TIME2                        11:30:00
    Export parameters               Value
    EX_DAYS                         0
    EX_TIME                         01:30:00
    2. SD_CALC_DURATION_FROM_DATETIME : Finds the difference between two date/time and report the difference in hours
    L_MC_TIME_DIFFERENCE : Finds the time difference between two date/time

Maybe you are looking for

  • AND/OR TRUTH TABLE.

    Is there any explanation for why 1) TRUE AND NULL = NULL 2) FALSE AND NULL = FALSE 3) TRUE OR NULL = TRUE 4) FALSE OR NULL = NULL Thank you, Narendra

  • How to create ejbbean in wd-java

    Hi, Iam new to Wd-java area.Iam doing the defecttracking application in Webdynpro for java,in that backend is sql server.I want to retrive login details through ejb bean. give me step-by-step coding procedure.i don't know how to create ejb applicatio

  • How to extract row number of geoRaster as number ?

    Hi all, I need to get the row (or similarly column and band) number of a georaster as number. Some approach that i have explored : (a) Using SDO_GEOR.getSpatialDimSizes, which return an sdo_Number_array. For example SDO_NUMBER_ARRAY(211, 725) means 2

  • Making a manual backup - what gets voted of the island?

    Process of elimination is getting it down to two items that are causing problems when I was backing up to the DVD. Which makes me think to ask this question... From the User folder, what items should be "backed up"? The usual suspects are in there -

  • Firefox doesn't pass vCalendar downloads to Outlook correctly.

    Setup Firefox to associate .vcs files with Outlook (not save to file,) and download a calendar entry from a web site such as United.com. When you confirm the download, Outlook will start and display an "Invalid command line entered, please check your