I wouldn't use variables for that, but maybe a calculated dimension (you could also use set analysis in your expressions to limit the date range, but let's start with a calculated dimension).
I assume you have a field Date with the month end dates and you want to show the last 6 months only.
Then you might try (using this as calculated dimension expression in dimension tab):
=if(Date>= addmonths(today(),-6), Date)
and also check suppress NULL on dimension tab.
If this is what you want, we can look into doing the same with set analysis, this is probably performing better on large data sets.
Hope this helps,