3 Replies Latest reply on Dec 20, 2013 12:52 PM by Caleb Smith

    Find the date of the LAST occurance

    Caleb Smith

      There's a great write-up of how to find the first date of an occurance here: http://kb.tableausoftware.com/articles/knowledgebase/first-date-purchased


      A key part of the solution is building a calculated field that does the following:


      DATEDIFF('day',WINDOW_MIN(MIN([Order Date])),MIN([Order Date]))


      I followed the instructions given in the write-up and everything works fine. However, for my particular problem, I want to find the LAST date of a particular occurrence, not the first. When I try to modify the calculated field to the following, I get negative numbers, rather than the positives I was expecting.


      DATEDIFF('day',WINDOW_MAX(MAX([Order Date])),MAX([Order Date]))


      Can anyone tell me what I'm doing wrong here? I still haven't' fully wrapped my head around the various WINDOW functions, so please pardon my ignorance if I'm trying to do something that's completely backward.