My filter context contains all dates in a financial year (eg. 1-Jul-2017 - 30-Jun-2018). I would like to calculate sales for the most recent full month in the selected financial year.
Eg. For the current financial year 1-Jul-2017 - 30-Jun-2018, I would like to calculate total sales for August, since it is the most recent full month in the period as of today (15-Sep-2016). I have tried the following:
Prem $ Last Closed Month = CALCULATE(SUMX(SalesFlat, [gross_amt_plus_lhc_annual]), DIM_DATE[MONTH_END_DATE] < NOW()) - CALCULATE(SUMX(SalesFlat, [gross_amt_plus_lhc_annual]), DATEADD(DIM_DATE[MONTH_END_DATE], 1, MONTH) < NOW())
But am getting the error "A function 'DATEADD' has been used in a True/False expression that is used as a table filter expression. This is not allowed."
Any ideas?
Thanks.