2 Replies Latest reply on Oct 8, 2018 3:24 PM by Jay Morehart

    Datediff not working - version 2018.1.1


      Hi everyone, could someone assist me on why my datediff calculated field is not working.  Thank you.


      DATEDIFF('day',[Only DatesPatch Publication Date],[Today])

        • 1. Re: Datediff not working - version 2018.1.1
          Don Wise

          Hi Terry,

          Difficult to say without a workbook, but try:


          DATEDIFF('day',[Only DatesPatch Publication Date], Today())


          Thx, Don

          • 2. Re: Datediff not working - version 2018.1.1
            Jay Morehart

            Definitely difficult with out either a workbook, or at least a screenshot showing how you have the view built, so I will have to make some assumptions.

            A few of these are actually correct (2018/01/09, 2018/07/10).

            Your days calculation would default to a measure, and so is likely on the view as a SUM(), my guess is that for some of these dates you have 2 records in your data (5346/2 = 2673 the number of days between 2011/06/14 and today).

            You can confirm this by putting [Number of Records] on the Columns shelf.

            There are a few ways to fix this,

            If you do not need it to be a measure, change your [Days] calculation to a dimension (either on the shelf, for this view only, or in the data pane)

            Or change the aggregation (again either in the view, or in the data pane) to MIN(), MAX(), ATTR(), or AVG() (these should be in order of preference for performance)


            Hope this helps!