KNOWLEDGE BASE

How to Filter and Highlight the Past, Present and Future Dates


Published: 15 Feb 2019
Last Modified Date: 22 Mar 2019

Question

How to filter date fields in order to display past, present and future dates.

Environment

  • Tableau Desktop

Answer

The calculation below can be applied to filters and also to chart colors to automatically highlight the past, present and future dates:

 

IF DATEDIFF("month",[Date],TODAY()) > 0 THEN "Past"

    ELSEIF DATEDIFF("month",[Date],TODAY()) = 0 then "Present"

    ELSEIF DATEDIFF("month",[Date],TODAY()) < 0 then "Future"

END


To review the proposed solution, please refer to the attached workbook.

Did this article resolve the issue?