I want to calculate a sum from the next month last year and last day current month. I.e., if I select 15 May 2018 the sum will be calculated from 1 June 2017 to 31 May 2018.
I did this:
MAT U =
VAR mindate = DATE(YEAR(MAX(DimDate[Date]))-1;MONTH(MAX(DimDate[Date]))+1;1)
VAR maxdate = DATE(YEAR(MAX(DimDate[Date]));MONTH(MAX(DimDate[Date]));(MAX(DimDate[Date])))
IMS_MOVIMENTOS[DATA] >= mindate && IMS_MOVIMENTOS[DATA] <= maxdate))
So basically the dates should be filtered always according to the maximum value of the Date table, even if there is a range date selected (even if 14 May 2018 to 15 May 2018 is selected on the date table slicer).
I think you need to replace the commas with semi-colons. The semi-colons that you had didn't work for me either so I had to switch to commas
Edit: Unless you mean that the VAR is calculating correctly but the entire measure is not. In response to you response about how you cannot use ALL. Maybe you can get around the problem with the 3 groups by creating a variable to grab the current group and then using ALL and explicitly filtering for the current group