KNOWLEDGE BASE

How to Keep Showing All the Headers When Viewing Recent Data with the Relative Date Filters


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

Question

When viewing recent data with the relative date filters, the headers with no value are not displayed. Is it possible to keep showing all the headers?

User-added image

Environment

  • Tableau Desktop

Answer

When using relative date filters, the underlying data is filtered out and the headers with no value are not displayed.

Below is a workaround for filtering data and keeping all the headers shown with parameters.
User-added image

1. Create the parameters as follows;
 User-added image
 User-added image
2. Right-click Last N and date-part parameters and select Show Parameter.
3. Create a calculated field and name it Sales with parameter. 
IF DATETRUNC([date_part],DATEADD([date_part],-[Last N]+1,TODAY())) <= [Order Date] AND [Order Date] <= DATEADD('day',-1,DATEADD([date_part],1,DATETRUNC([date_part],TODAY())))  
    THEN [Sales] 
ELSE 0 
END
4. Add Category and Sub-Category to Rows.
5. Add SUM(Sales with parameter) to Text.
Did this article resolve the issue?