This is an issue that comes up once in a while. There are always multiple alternative solutions to the same issue in Tableau. Here is my favorite one. Simple and easy. No need to use Index() function. It applies to current month/year or last N months/years.

Assume you have used Dateparse(string_date) to convert it to a date type, in case it is a string.

1.Excluding the current week

Datediff('week',date,max(date)) >0 Surprisingly non-aggregated and aggregated terms can be laid side by side. Tableau usually is stringent on aligning the aggregation of variables.

2.Excluding the last N weeks

Datediff('week',date,max(date)) >N 3.Getting the result of the Nth week

Datediff('week',date,max(date)) =N-1  Voila, hope this helps.

[Update: After publishing this blog, I found that, since Tableau 10.3, a new feature has been added to ease the pain. It basically solved the problem. For those who are still using 10.2 or who like to understand the Top option of the filter, this blog still can help.
2
Blog Archive
Loading
Dynamic Views theme. Powered by Blogger. Report Abuse.