Forum Discussion
Totalling error in MTD sales
monojchakrab , Try like
LMTD QTY forced=
Var _Maxdate = MAX('Date Table'[Date])
var _max = date(year(_Maxdate),month(_Maxdate)-1,day(_Maxdate))
return
if(max('Date'[Date])<=_max, CALCULATE(Sum('order'[Qty]),DATESMTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max), blank())
//OR
//CALCULATE(Sum('order'[Qty]),DATESMTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max)
//TOTALMTD(Sum('order'[Qty]),dateadd('Date'[Date],-1,year),'Date'[Date]<=_max)
Comments are alternate options
amitchandak - Amit, actually, surprisingly, the LMSP (last month same period), actually returns the right figure.
Its the MTD and only for the month of Feb, where there is a problem.
If there something else I need to look at? I dont think the measure is a problem as the same measures work fine for all other months.
Anyways - thank you for being in my corner