Dynamic Filtering for Last X Quarters with String Fields (2024 Q1) - Perfect for Forecasted Data

Опубликовано: 10 Август 2026
на канале: Golden Insights
198
3

Learn how to filter the last X time periods, such as quarter-year, in Tableau using string fields instead of date fields. When working with string fields in Tableau, direct filtering for recent periods isn’t possible. I’ll walk through creating a calculated field to convert quarter-year strings into a sequential number, then using this as a dynamic Top N filter (like the last 8 quarters). This approach is perfect for scenarios like forecasted data, where you might only have quarter-year values instead of exact dates, ensuring your filter always updates to show the latest periods as new data is added—ideal for keeping your Tableau dashboards current.

Tableau: https://public.tableau.com/app/profil...

Excel: https://docs.google.com/spreadsheets/...

Formulas:
Quarter - Year (Seq): INT(LEFT([Quarter - Year], 4)) * 4 + INT(RIGHT([Quarter - Year], 1))

The formula converts each quarter-year string (e.g., “2023 Q1”) into a unique sequential number. This number can then be used in the Top N filter to dynamically capture the latest X periods.