I need to summarize dax table and filter it by date range 5 month back from last EffectiveDate
, which is 7/27/2019
So my dax expression:
TestTable1 =
VAR LastEffDate = LASTDATE(fact_Premium[EffectiveDate]) // -- 7/27/2019
RETURN
SUMMARIZE(
FILTER(dim_Date, DATEDIFF(DATEADD(STARTOFMONTH(LastEffDate), -5,MONTH), ENDOFMONTH(LastEffDate), MONTH)),
dim_Date[Year Month],
"Premium", [Ttl WP]
)
But for some reason it brings me data for all years in a dataset:
I also tried:
TestTable1 =
VAR LastEffDate = LASTDATE(fact_Premium[EffectiveDate]) // -- 7/27/2019
RETURN
SUMMARIZE (
FILTER (
dim_Date,
DATESBETWEEN(dim_Date[Date],
DATE(2019,5,1),
DATE(2019,6,1)
)
),
dim_Date[Year Month],
"Premium", [Ttl WP]
)
But it gives me an error:
A table of multiple values was supplied where a single value was expected.
Am I missing something here?