Forum Discussion
Anonymous
3 years agoNot applicable
Previous Year To Date
Hi, Apologies as I know this has been asked and answered numerous times before. I'm trying to get the sales for LY 01/01/2022 to todays date but unsure on how to go about it. I tried to u...
- 3 years ago
hi Anonymous
you need some code to reflect YTD, try like:
CALCULATE(
SUM(Transactions[Sales]),
DATESYTD(SAMEPERIODLASTYEAR(Calendar[Date]))
)
BrianConnelly
Resolver III
3 years agoI am oversimplify so you can follow the DAX and test, but you need to start with wrting some variables.
PreviousYearTodate=
VAR todayYear = Year(Today())
VAR todayMonth= Month(Today())
VAR todayDay = Day(Today())
RETURN CALCULATE(SUM(Transactions[Sales]),
FILTER(ALL(Calendar),YEAR(Calendar[Date]) = todayYear -1
&& Month(Calendar[Date]) <= todayMonth
&& Day(Calendar[Date]) <= todayDay )
)