Forum Discussion
RT6
2 years agoFrequent Visitor
same months comparison over the years - DAX
Hi all! i use this DAX CY = CALCULATE(SUM('Market'[Sales]), DATESMTD('Calendar'[Date]))/1000; and for the last year LY = CALCULATE(SUM('Market'[Sales]),DATESMTD(dateadd('Calendar'[Date],...
- Anonymous2 years ago
Hi RT6
Thanks for the reply from Dangar332 , please allow me to provide another insight:
My sample:
Create a measure as follows
comparison = VAR _previous = CALCULATE(SUM(Market[Sales]), FILTER(Market, [Date] IN SAMEPERIODLASTYEAR('Calendar'[Date]))) VAR _current = CALCULATE(SUM(Market[Sales]), FILTER(ALL(Market), [Date] IN VALUES('Calendar'[Date]))) RETURN DIVIDE(_previous + _current, 1000)Result:
Best Regards,
Yulia XuIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
2 years agoNot applicable
Hi RT6
Thanks for the reply from Dangar332 , please allow me to provide another insight:
My sample:
Create a measure as follows
comparison =
VAR _previous = CALCULATE(SUM(Market[Sales]), FILTER(Market, [Date] IN SAMEPERIODLASTYEAR('Calendar'[Date])))
VAR _current = CALCULATE(SUM(Market[Sales]), FILTER(ALL(Market), [Date] IN VALUES('Calendar'[Date])))
RETURN
DIVIDE(_previous + _current, 1000)
Result:
Best Regards,
Yulia Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
RT6
2 years agoFrequent Visitor
hi Yulia,
thanks for your response! SAMEPERIODLASTYEAR worked well in this case 🙂