TimeStampDiff Function

Hi Guys,
I have an function that says calculate the difference in Months between the opportunity expected close date and Today's date
Timestampdiff(SQL_TSI_MONTH,Current_Date,"Close Date".Date)
Today is the 8th December.
My report shows:
Close Date:.................. 23-Nov-10
Months Difference:........ -1
Close Date: ................. 24-Nov-10
Months Difference: ......... 0
But i think any date in November should be '-1' months difference from today.
Anyone know why this shows 0
Thanks
Minesh

Duplicate thread. Please only post once.
Error in function

Similar Messages

  • TIMESTAMPDIFF  function in OBIEE Answers

    Hi experts,
    I have a Answers report, where I have included a column and changing the fx formula to find out the time diff ..
    TIMESTAMPDIFF(SQL_TSI_DAY, "Bank Transactions - Payor Aging".AccountingDate, "Bank Transactions - Payor Aging".AccountingDate)
    here I want the second "Bank Transactions - Payor Aging".AccountingDate to be replaces with any date like as below
    TIMESTAMPDIFF(SQL_TSI_DAY, "Bank Transactions - Payor Aging".AccountingDate, '06/02/2010') for June-02-2010.
    But, the above date format is working... can any suggest what format I have give here to work.
    Thanks in Advance
    S

    Hi Madan...
    Thanks for the quick reply...
    I want to continue by next question on top of the TIMESTAMPDIFF function....
    TIMESTAMPDIFF(SQL_TSI_DAY, "Bank Transactions - Payor Aging".AccountingDate, TIMESTAMP '2010-06-02 00:00:00')
    how can I pass this part of the value from the Dashboard Prompt. I knew that the dashboard prompt can only be created on the presentation column. I can't put any date column in my datawarehouse datamodel as there is already one. I looking if there any other way of passing the second date value from the dashboard prompt.
    Thanks in Advance
    S

  • TIMESTAMPDIFF function in combined analysis

    Hello,
    Has anyone used the timestampdiff function in a combined analysis? I have created a combined analysis with using two subject areas and tried using the timestampdiff function in the results section but its not giving me the right results. I am using timestampdiff(sql_tsi_day, saw_5, saw_3).
    Any help is appreciated.
    Thanks!
    Sonia

    I guess you can use TIMESTAMP functions in result columns. The only case where you may hit an error is when one of the columns(say saw_5) is having a null/blank value for the corresponding value in saw_3.

  • OBIEE timestampdiff function syntax error

    Hi all,
    I am getting an error while applying timestampdiff function .help me to sort it out.
    TIMESTAMPDIFF(SQL_TSI_DAY,"- Sanction and Disbursment"."Value Date" , VALUEOF(NQ_SESSION.VAR_CAL_CURR_DATE))
    error details
    Formula syntax is invalid.
    [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 22025] Function TimestampDiff is called with an incompatible type.Please have your System Administrator look at the log for more details on this error. (HY000)
    SQL Issued: SELECT TIMESTAMPDIFF(SQL_TSI_DAY,"- Sanction and Disbursment"."Value Date" , VALUEOF(NQ_SESSION.VAR_CAL_CURR_DATE)) FROM "SIDBI Master"

    Aswin,
    Syntax looks to be fine but before applying it here can you check if both these 2 parameters returns date in same format:
    "- Sanction and Disbursment"."Value Date" = 08/21/2011 (No Timestamp)
    VALUEOF(NQ_SESSION.VAR_CAL_CURR_DATE) = 08/21/2011 (No Timestamp)
    Both shud have same format.
    Also, try this for verification
    TIMESTAMPDIFF(SQL_TSI_DAY,"- Sanction and Disbursment"."Value Date" , CURRENT_DATE)
    Hope this helps

  • TimeStampDiff function ROUNDing the result. How can we avoid this?

    Hi,
    I am using the following timestamp function:
    TIMESTAMPDIFF(SQL_TSI_HOUR, "SF_CS_CS_Fact"."Crtddt_Dt", "SF_Emlmssg_Sum_CS"."Initl Resp Tm")
    I notice that the result set is rounded off to the whole no.
    This is happening because OBIEE autimatically ROUNDS the difference of the timestamps whe using TIMESTAMPDIFF:
    select distinct D1.c1 as c1,
    D1.c2 as c2,
    D1.c3 as c3,
    D1.c4 as c4,
    D1.c5 as c5,
    D1.c6 as c6,
    D1.c7 as c7,
    D1.c8 as c8,
    D1.c9 as c9,
    D1.c10 as c10
    from
    (select D1.c1 as c1,
    D1.c2 as c2,
    D1.c3 as c3,
    D1.c4 as c4,
    D1.c5 as c5,
    D1.c6 as c6,
    D1.c7 as c7,
    D1.c8 as c8,
    D1.c9 as c9,
    D1.c10 as c10
    from
    (select 0 as c1,
    D1.c4 as c2,
    D1.c5 as c3,
    D1.c3 as c4,
    D1.c2 as c5,
    D1.c6 as c6,
    D1.c7 as c7,
    D1.c8 as c8,
    D1.c9 as c9,
    D1.c1 as c10,
    ROW_NUMBER() OVER (PARTITION BY D1.c2, D1.c3, D1.c4, D1.c5, D1.c6, D1.c7, D1.c8, D1.c9 ORDER BY D1.c2 ASC, D1.c3 ASC, D1.c4 ASC, D1.c5 ASC, D1.c6 ASC, D1.c7 ASC, D1.c8 ASC, D1.c9 ASC) as c11
    from
    (select distinct ROUND ( ( CAST(T14421.INITIAL_RESPONSE_TIME as DATE)  - CAST(T14963.CRTDDT_DT as DATE)  ) 24 ) as c1*,
    T14963.CRTDDT_DT as c2,
    T14963.CSNMBR as c3,
    T4813.FISCAL_YEAR_NAME as c4,
    T4813.FISCAL_QUARTER_NAME as c5,
    T14421.INITIAL_RESPONSE_TIME as c6,
    T14468.GRP as c7,
    T4813.FISCAL_YEAR_ID as c8,
    T4813.FISCAL_QUARTER_ID as c9
    from
    DW_SF_EMLMSSG_SUM_CS T14421,
    DW_SF_EMLMSSG_CS T14400,
    SF_ORGN_CS_DIM T14468,
    CIN_CALENDARS_DIM T4813,
    DW_SF_CS_CS T14963 /* SF_CS_CS_Fact */
    where ( T14400.PRNTID = T14963.ID and T4813.CALENDAR_KEY = T14963.CRDT_KEY and T14421.PRNTID = T14963.ID and T14400.STTS = '3' and T14468.ORGN_KEY = T14963.ORGN_KEY and T14963.TYP = 'CIN' and (T14963.CSNMBR in ('1103676964', '1103677035', '1103677076', '1103677285', '1103677303', '1103677369', '1103677389')) )
    ) D1
    ) D1
    where ( D1.c11 = 1 )
    ) D1
    order by c1, c8, c9, c7, c4, c5, c6, c10
    Please see the line in Bold in the query.
    I want to get the results in the actual decimal point and not the whole no. Is there a way that I can enable the TIMESTAMPDIFF not to ROUND by default.
    Any answers will be helpful.
    Thanks,

    When you specify in the interval in the first argument of TIMESTAMPDIFF you are implicitly telling OBIEE the level of precision that you want. For SQL_TSI_YEAR you are going to get integer values of whole years. if yo uneed to get more granular than that you need to use SQL_TSI_MONTH or WEEK.
    Also note, than when performing mathematical operations like divide an multiply, all elements of the calculation need to be a data type that can represent decimal values, or the result of the entire calc will always get converted to an integer.

  • Timestampdiff() function: result in  millisecond

    Hello,
    I'm using the OBIEE timestampdiff() to calculate the difference between two timestamps, before to continue to use this function I want to check if the function can calculate the delay in second and give result like this example:
    TIMESTAMPDIFF(SQL_TSI_SECOND, CAST("LOGFILE_VORDEL"."DATE_HOUR" as timestamp),CAST("LOGFILE_VORDEL_S"."DATE_HOUR" as timestamp))=19,23 sec
    which mean
    19 Second and 23 Millisecond.

    try to make it informatica. not sure obiee can support to_date function where you can get date format in milliseconds.

  • "TimestampDiff" function error

    Hi,
    case when TimestampDiff(YEAR, BIRTH_DT, '2009-07-06 00:00:00.000') < 18 then 'A: <18' end
    above query throws error in oracle, This function "TimestampDiff" is not in oracle.
    How it make above query in oracle?
    Please help me.
    Thanks.

    Duplicate thread. Please only post once.
    Error in function

  • TimeStampDiff

    Hello experts,
    I want to know How to use TimeStampDiff function appropriately.
    My requirement is I have a column in the physical layer say time. It is of datatype varchar(5). It stores the values in HH:MM format.
    I want to have the difference between the current time and this column.
    For current time, Im using function in OBI Answers: CURRENT_TIME(2) where 2 denotes the precision of seconds.
    The formula Im using is TIMESTAMPDIFF(SQL_TSI_MINUTE, CAST("Query Time".Time AS TIMESTAMP), CURRENT_TIME(2)).
    This is throwing the following error:
    ORA-01843: not a valid month at OCI call OCIStmtExecute: select D1.c1 as c1, D1.c2 as c2, D1.c3 as c3, D1.c4 as c4, D1.c5 as c5, max(D1.c6) over () as c6 from (select distinct D1.c2 as c1, D1.c3 as c2, D1.c4 as c3, TO_DATE('1900-01-01 03:54:07' , 'YYYY-MM-DD HH24:MI:SS') as c4, D1.c1 as c5, D1.c1 as c6 from (select max(T45654.TOTAL_TIME_SEC) as c1, TRUNC(T45677.DAY_DT) as c2, ROUND( ( TO_DATE('1900-01-01 03:54:07' , 'YYYY-MM-DD HH24:MI:SS') - CAST( cast(T45654.START_HOUR_MIN as DATE) as DATE) ) * 1440 ) as c3, T45654.START_HOUR_MIN as c4 from S_ETL_DAY T45677, S_NQ_ACCT T45654 where ( T45654.START_DT = T45677.DAY_DT and T45654.SAW_SRC_PATH = '/shared/PI BOOK of Business - P2/AE Home Page/Search/P2 - Trust Request' and TRUNC(T45654.START_DT) = TO_DATE('2009-03-09' , 'YYYY-MM-DD') and TRUNC(T45677.DAY_DT) = TO_DATE('2009-03-09' , 'YYYY-MM-DD') ) group by T45654.START_HOUR_MIN, TRUNC(T45677.DAY_DT) ) D1 ) D1 order by c1 desc, c2, c3, c4. [nQSError: 17011] SQL statement execution failed. (HY000).
    Can anybody help me get the right formula?
    thx,
    parag

    Hi.
    I try the similar:
    TIMESTAMPDIFF(SQL_TSI_MINUTE, CAST('14:22' AS TIMESTAMP), CURRENT_TIME(2))
    and I got an error:
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 17001] Oracle Error code: 1843, message: ORA-01843: not a valid month at OCI call OCIStmtExecute: select distinct D1.c1 as c1, ROUND( ( TO_DATE('1900-01-01 12:05:33' , 'YYYY-MM-DD HH24:MI:SS') - CAST( cast('14:23' as DATE) as DATE) ) * 1440 ) as c2 from (select distinct T21473.PROD_CATEGORY as c1 from PRODUCTS T21473 ) D1 order by c1, c2. [nQSError: 17011] SQL statement execution failed. (HY000)
    So the syntax is:
    TimestampDiff (interval, timestamp-expression1, timestamp-expression2)
    If you harcode it:
    Timestampdiff(SQL_TSI_MINUTE, TIMESTAMP '2009-04-28 12:00:00', current_timestamp)
    The results is difference in minutes.
    So you just need to put 'the right expression' in the second place. Try to concatenate current date with your time value and place it insted of TIMESTAMP '2009-04-28 12:00:00' because this inputs only timestamp format.
    Hope this helps.
    Regards,
    Goran
    http://108obiee.blogspot.com/

  • Timestampdifference function

    Hi all,
    I have to find the number of years and months from timestampdiff function. for example first date 1/1/2010 and second date 1/6/2011 i have to show 1 year 6 months as the result of timestampdiff. It is showing only for month or year. i want both together. thanks for any help

    Hi Guys,
    Finding your comments really useful. One thing I have been stuck on is the difference between two dates in dates, times.
    so like the prevous thread i just want to get years, months, days, hours, minutes, seconds. I have the difference in years and months but I can't seem to work out the rest......I know you guys are ace at this could you help with this challenge?
    Many Thanks
    SR
    Example: 0 Yeras 0 Months 23 days 7 Hours 4 minutes 12 seconds as a result between two date timestamps

  • TIMESTAMPDIFF question

    Does anyone know why I'm getting different result for the following:
    TIMESTAMPDIFF(SQL_TSI_MONTH, expr1, CURRENT_DATE) where expr1 = 10/15/2008. The result is 12.
    TIMESTAMPDIFF(SQL_TSI_MONTH, expr1, CURRENT_DATE) where expr2 = 10/31/2008. The result is 11.
    CURRENT_DATE is 10/2/2009.
    It seems the system treats 10/31/2008 same as 11/1/2008. I also tried to put CAST(expr1 AS DATE) function. The answer is still the same.
    What do I need to do to get the same answer above?

    Hi all,
    I am also curious to know whether the timestampdiff function gives different values when used in different server
    Eg:Timestampdiff(min,2009-10-10,2009-10-12)
    The above formula when used in different environment using different sever gives different values.
    Can we fix this?
    Thanks

  • TIMESTAMPDIFF rounding to 2 decimal places instead of 0

    Hi,
    Requirement is to find difference between two timestamp column,
    as known one we cannot perform arithmetic operation in non number type in rpd.
    Hence tried using TIMESTAMPDIFF function as below,
    TimeStampDiff(SQL_TSI_MINUTE, MONITOR_TIMESTAMP, ATT_TIMESTAMP" )
    OBIEE server converting this function to below SQL ,
    ROUND( ( CAST(ATT_TIMESTAMP as DATE) - CAST(MONITOR_TIMESTAMP as DATE) ) * 1440 )
    this returns value as ex: 12 as rounded value without any decimal places.
    but we want to have two decimal places, how to fix this or any work around ?
    Thanks,
    Satheesh

    instead of * 1440
    do with
    * 1440.00
    btw: why you need to cast to date? why cant be timestamp?
    Discard it

  • Service Requests Open 5 days?/Service Requests Open and Closed Today

    Help!
    How would I determine service requests open greater then 5 days, I use the # of Open SR's but cannot seem to get a date to work.
    Also what is the best way to count the SR's open and closed on the same day?
    Thanks in advance.

    You need to include a TIMESTAMPDIFF function in your filter... something to the effect of
    TIMESTAMPDIFF(SQL_TSI_DAY,"Service Request"."Create Date",CURRENT_DATE) > 5
    Double check the column reference.
    Mike L

  • How to get the number of days

    hai bloggers,
    see we have 365 days per year for first half we are going to have 180+ days (if we select first half as the prompt and we select week number as prompt and the last date of that particular week should show in the report)and number of days upto that date or week also should display...if we select second half and week number of that particular half it should show number of days upto that week and highest date of that week number of days should count from 1 to 180+ only mean (july 1 st is 1 st day)
    thanks

    You need to use timestampdiff function for calculating number of days. One of the way to calculate is like this
    case when "Time"."Calendar Half Year" = 1 then timestampdiff(SQL_TSI_DAY,CAST(EVALUATE('TO_DATE(%1,%2)','01-01'||'@{YEAR}{2010}','DD-MM-YYYY') AS DATE),CAST(EVALUATE('TO_DATE(%1,%2)','30-06'||'@{YEAR}{2010}','DD-MM-YYYY') AS DATE)) else timestampdiff(SQL_TSI_DAY,CAST(EVALUATE('TO_DATE(%1,%2)','01-07'||'@{YEAR}{2010}','DD-MM-YYYY') AS DATE),CAST(EVALUATE('TO_DATE(%1,%2)','31-12'||'@{YEAR}{2010}','DD-MM-YYYY') AS DATE)) end
    If you want calculate between 1st day of the half and last date of a week then use following
    case when "Time"."Calendar Half Year" = 1 then timestampdiff(SQL_TSI_DAY,CAST(EVALUATE('TO_DATE(%1,%2)','01-01'||'@{YEAR}{2010}','DD-MM-YYYY') AS DATE),MAX(MAX("Time"."Calendar Date"))) else timestampdiff(SQL_TSI_DAY,CAST(EVALUATE('TO_DATE(%1,%2)','01-07'||'@{YEAR}{2010}','DD-MM-YYYY') AS DATE),MAX(MAX("Time"."Calendar Date"))) end
    Hope it will answer your question
    Thanks,
    Phani.

  • Find the Difference in time for creation of two activities for the same SR

    Hi
    I need to find the difference in time of cretaion of two different activities for an SR. Is there any function which I can use to get the same
    For e.g.
    SR # |Activity Created Date |Duration
    123 12-nov
    123 13 nov 1 day
    Thanks in advance
    Meena

    There's a TIMESTAMPDIFF function.
    An example from the book Oracle CRM On Demand Reporting has the following example...
    TIMESTAMPDIFF( SQL_TSI_MINUTE, Activity."Start Time", Activity."End Time" )
    which would return the difference in minutes.
    As I type this, I'm thinking you probably know this and your problem is how to get the Activity start time for the next activity into this function. I sorry can't think of any way to do that.

  • Date format in the RPD

    Hi gurus,
    In the rpd, I have a condition where
    If (received_date- current_date) < X then ....
    the received date in the database is numeric. Ex : 20040810
    How do I change the date format to match the default current date in the expression builder.
    Thanks
    Avinash

    Looks like you are using this calculations based on fact table or might be physical columns.
    I would suggest to use logical columns so that you can use the date(for received_date) column your day dim.
    or else
    map the day dim to fact table and use physical expression for the same, its same as your other post with status=completed as I said in my last email.
    You have to use timestampdiff function.
    If helps mark
    Edited by: Srini VEERAVALLI on Feb 20, 2013 2:47 PM

Maybe you are looking for