Forum Discussion
rajasekar_o
1 year agoHelper V
LY MTD Calculation
Hi team, i want to calculate LYMTD Used Measure LY MTD Sales = VAR CurrentDate = MAX('date'[Date]) VAR PreviousYearDate = EDATE(CurrentDate, -12) RETURN CALCULATE( [sales amount], ...
- Anonymous1 year ago
Hi, rajasekar_o
Thanks for Kedar_Pande, Greg_Deckler and bhanu_gautam replies. Are you currently addressing this issue? If not, you can refer to the following dax.LY MTD Sales = VAR _currentDate = MAX('Table 2'[Inv Date]) VAR _previousYearDate = EDATE(_currentDate, -12) VAR _item = SELECTEDVALUE('Table 2'[Item]) RETURN CALCULATE( SUM('Table 2'[Amount]), FILTER( ALL('Table 2'), 'Table 2'[Inv Date] <= _currentDate && 'Table 2'[Inv Date] >= _previousYearDate && 'Table 2'[Item] = _item ) )Best Regards,
Yang
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Greg_Deckler
1 year agoCommunity Champion
rajasekar_o Maybe:
LY MTD Sales =
VAR CurrentDate = MAX('date'[Date])
VAR PreviousYearDate = EDATE(CurrentDate, -12)
VAR __Table = FILTER( ALL( 'Sales' ), 'Sales'[Date] <= PreviousYearDate && 'Sales'[Date] >= DATE( YEAR( CurrentDate) - 1, MONTH( CurrentDate ), 1 ) )
VAR __Result = SUMX( __Table, [Amount] )
RETURN
__Result