KNOWLEDGE BASE

How to Use Data Source Filter to Obtain Only the Data for the Last Day of Each Year and Month


Published: 07 Sep 2023
Last Modified Date: 08 Sep 2023

Question

How do we use data source filter to obtain only the data for the last day of each year and month?

User-added image

Environment

  • Tableau Desktop

Answer

Below is an example for adding a data source filter to obtain only the data for the last day of each year and month.  Follow along in the sample packaged workbook available in the Attachments section of this article.

1. Create a calculated field and name it Filter with the following formula:
[Order Date] = { FIXED DATETRUNC('month',[Order Date]) : MAX([Order Date]) }
2. On the Data Source page, click Add in the Filters section in the upper-right corner of the page.
3. Click the Add button in Edit Data Source Filters dialog.
4. Select Filter field and click OK.
5. Select "True" and click OK.
6. Click OK button in Edit Data Source Filters dialog.

Note: This data source filter will only return the rows for the last day of each year and month and exclude all other data points, thereby reducing the amount of data in the data source. 

If you would like to obtain only the data for the first day of each year and month, change the formula in step 1 as follows;
[Order Date] = { FIXED DATETRUNC('month',[Order Date]) : MIN([Order Date]) }
Did this article resolve the issue?