KNOWLEDGE BASE

How to Sort the Data Dynamically by the Current Month's Values When a Workbook is Opened


Published: 07 Dec 2022
Last Modified Date: 08 Dec 2022

Question

When a workbook is opened, is it possible to sort the data dynamically by the current month's values?

Environment

  • Tableau Desktop

Answer

Below is an example using the Sample - Superstore. If you open the workbook on 2022/12/01, it will be sorted in descending order of Sales on 2022/12.
User-added image

1. Add Year(Order Date) to Columns.
2. Add Month(Order Date) to Columns.
3. Add Sub-Category to Rows.
4. Add SUM(Sales) to Text.
5. Create a calculated field and name it Sort.
IF DATETRUNC('month', [Order Date]) = DATETRUNC('month', TODAY())
    THEN [Sales]
END
6. Right-click Sub-Category in Rows and select Sort.
7. Edit Sort as follows:
 User-added image
Did this article resolve the issue?