KNOWLEDGE BASE

SQL Filter for 24 Months from Today's Date


Published: 14 Sep 2016
Last Modified Date: 15 Sep 2016

Question

How to dynamically filter the data on the last 24 months from today's date, when using a custom SQL table. 

Environment

  • Tableau Desktop
  • Custom SQL table

Answer

Use the following WHERE clause:
WHERE (([Table].[Date] >= DATEADD(MONTH, -24, GETDATE())) AND ([Table].[Date] <= GETDATE()))
Did this article resolve the issue?