top of page

Display the Filtered Date Range with a Dynamic Header

Would you like to have a text header at the top of your line chart that displays the filtered range? Would you like this header to change, when you apply a new date filter to your dashboard? See the below steps to do so.


The formula in this tip was brought to you by Will Perkins. (@_gringuinho_) Will is very active in the Tableau Community and I consider him to be an expert in Tableau!


In the below example the header changes when you change the Date Range filter.

Here is an example line graph I have created using the Sample-Superstore dataset. I have Month(Order Date) in the Columns shelf and I have Sales on the Rows shelf.

I also have Order Date as a date range filter for this worksheet.





I created the following Calculated Field in the Tableau Worksheet.


Dynamic Header

"Monthly Trend from "+

LEFT(STR(DATENAME('month',WINDOW_MIN(min([Order Date])))),3)+

"'"+

RIGHT(STR(YEAR(WINDOW_MIN(min([Order Date])))),2)+

" to "+

LEFT(STR(DATENAME('month',WINDOW_MAX(max([Order Date])))),3)+

"'"+

RIGHT(STR(YEAR(WINDOW_MAX(max([Order Date])))),2)


I placed this header before the Order Date field on the Columns shelf. I ensured the default Table calculation was Table Across.



I also right-clicked on the text "Dynamic Header" in the line chart and selected Hide Field Names for Columns.




484 views0 comments

Comments


bottom of page