Oct
20
Excluding the current week or the last N weeks
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.
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.