Forum Discussion
aryank2000
7 years agoFrequent Visitor
Prior MTD calculation
Hi, I need to calculate MTDs for prior year. Here is my requirement. I would need to calculate counts of measure for full month for all months in prior year and only "to date" in corresponding mo...
Anonymous
7 years agoNot applicable
[Your Measure] := var __today = today() var __datesUpToToday = CALCULATETABLE( VALUES( DimDate[Date] ), DimDate[Date] <= __today, ALL( DimDate ) -- technically this is not necessary ) var __datesMtd = DATESMTD( DimDate[Date] ) var __intersection = INTERSECT( __datesMtd, __datesUpToToday ) var __lastYearSalesMtd = CALCULATE( SUM( 'FactTable'[SalesAmount] ), SAMEPERIODLASTYEAR( __intersection ) ) return __lastYearSalesMtd
Best
Darek