locked
Datediff not returning the correct number of days RRS feed

  • Question

  • Hi,

    I am working on a CRM 2011 project hosted in the cloud. I have created a custom report that is grouping the cases based on the day differences between 2 dates related to the case. I have a calculated field that show day difference and here is the formula I am using:

     

     =DateDiff("d",Fields!createdonValue.Value, Fields!modifiedonValue.Value)

    Seems like the number this method returns is always one below what it should be for all non-zero values:

     

    Does anyone have any clue why I am getting this weird behavior?

     

     

     

    Thanks,

    Sina

     


    captainsina
    • Edited by captainsina Monday, December 19, 2011 7:38 PM
    Monday, December 19, 2011 7:37 PM

Answers

  • hi Sina,

    its considering the time factor that the reason you have one less days

    for eg the first 13/12/2011 10.13 pm - 13/12/2011 4.44 pm is not one day

    you need to provide additional logic to add one to the total if the difference is less than 24 hours

    hope i have clarified

    dk

     if the response answered your question, please take a minute and mark the response as an answer.

    • Proposed as answer by D kay Monday, December 19, 2011 8:17 PM
    • Marked as answer by captainsina Monday, December 19, 2011 8:31 PM
    Monday, December 19, 2011 8:17 PM

All replies

  • hi Sina,

    its considering the time factor that the reason you have one less days

    for eg the first 13/12/2011 10.13 pm - 13/12/2011 4.44 pm is not one day

    you need to provide additional logic to add one to the total if the difference is less than 24 hours

    hope i have clarified

    dk

     if the response answered your question, please take a minute and mark the response as an answer.

    • Proposed as answer by D kay Monday, December 19, 2011 8:17 PM
    • Marked as answer by captainsina Monday, December 19, 2011 8:31 PM
    Monday, December 19, 2011 8:17 PM
  • hi Sina,

    its considering the time factor that the reason you have one less days

    for eg the first 13/12/2011 10.13 pm - 13/12/2011 4.44 pm is not one day

    you need to provide additional logic to add one to the total if the difference is less than 24 hours

    hope i have clarified

    dk

     if the response answered your question, please take a minute and mark the response as an answer.

    Thanks for the reply. You are absolutely right.

     


    captainsina
    Monday, December 19, 2011 8:32 PM