Hi Sam,
thanks for your reply.
It concerns a fact table with purchased items from our buying team.
I also have a seperate date table, (datum[date] with a relation to the purchase date from the fact table (Aankopen[Inkoopdatum])
I first made a measure for total purchases like this ;
**Inkoopbedrag = SUMX(Aankopen, Aankopen[Aantal gekocht]*Aankopen[Originele prijs])**
Then I made the measure for the MontToDate like this ;
**Tot Inkoop MTD = **
**VAR LastInkoopDatum = MAXX(ALL(Aankopen[Inkoopdatum]),Aankopen[Inkoopdatum])**
**VAR MTDAankopen = TOTALMTD([Inkoopbedrag], Datum[Date])**
**RETURN **
**IF(MIN(Datum[Date]) <= LastInkoopDatum, MTDAankopen, BLANK())**
To caclulate the Month to date Last Year I used the following ;
**Tot Inkoop MTD LY = CALCULATE([Tot Inkoop MTD], DATEADD(Datum[Date], -1,YEAR))**
To have the data stop at the last known purchase date I used the following measure ;
**Tot Inkoop MTD lastDate LY = **
**VAR LastInkoopDatum = MAXX(ALL(Aankopen[Inkoopdatum]),Aankopen[Inkoopdatum])**
**VAR MTDAankopenLY = TOTALMTD([Tot Inkoop MTD LY], Datum[Date])**
**RETURN **
**IF(MIN(Datum[Date]) <= LastInkoopDatum, MTDAankopenLY, BLANK())**
Looking at the data in table viewit seems to do exactly what I need, except for the total.
This remains the total amount for the enitre month, rather than the amount I am looking for
Worth mentioning is that my Page filter consist of a selection in Year/Quarter/Month.
Granularity of the table is by date, but I still need to show and calculate with the max end date amount last year.
Thanks
Juno