Forum Discussion
Kt1097
5 years agoNew Member
Dynamic YTD across multiple years
Hello, after hours of reading different posts and trying out formulas, I still haven't found a solution for my problem. There are two columns from my table that are relevant here: Sales units an...
- 5 years ago
We finally came up with a measure that works for our purpose:
YTD sales units =
TOTALYTD(SUM('Sales'[Sales units]); 'Sales'[Date];MONTH('Sales'[Date])<=MONTH(NOW())
BI_Maverick
1 year agoRegular Visitor
Hi Kt1097 , you can try the measure below and it would get you the desired results, thanks
YTD Sales Until Today =
VAR TodayDay = DAY(TODAY())
VAR TodayMonth = MONTH(TODAY())
RETURN
CALCULATE(
SUM('SalesTable'[Sales units]),
FILTER(
ALL('Calendar'),
'Calendar'[Month] < TodayMonth
|| (
'Calendar'[Month] = TodayMonth
&& 'Calendar'[Day] <= TodayDay
)
)
)