Filter the View by a Chosen Month and the Next Month in the Data Set

Published: 17 May 2018
Last Modified Date: 08 Jan 2019


How to create a range filter that will filter starting from the month selected in a parameter to the next month that exists in the data set. For example, if the view is already filtered to one customer, then that customer may not have data for every month.


Tableau Desktop


The attached example workbook uses the sample data set Superstore to demonstrate the following directions:
  1. Click the down arrow next to Dimensions in the data pane and select Create Parameter…
  2. In the Create Parameter dialog, do the following and click OK:
    • Name the parameter. In this example I will call it "Select Start Date"<.li>
    • For Data Type, choose Date
    • For Allowable values, select Range
    • Check Step size and select 1 Months
  3. Right-click [Select Start Date] in the data pane and select Show Parameter Control
  4. Select Analysis > Create Calculated Field
  5. In the Calculated Field dialog box that opens, do the following, and then click OK:
    • Name the calculated field. In this example, the calculated field is named "Date Filter"
    • In the formula field, create a calculation similar to the following:

      IF DATETRUNC('month', [Order Date]) >= [Select Start Date]
      THEN [Order Date]

  6. Drag [Date Filter] to the Filters shelf
  7. In the Filter Field dialog, select Month / Year and click Next >
  8. In the Filter dialog, do the following and click OK:
    • Navigate to the Condition tab
      • Select by formula
      • Type in the formula: NOT ISNULL(MIN([Date Filter]))
    • Navigate to the Top tab
      • Select By field
      • Select Bottom 2 by Date Filter Minimum
Did this article resolve the issue?