Trying to use a simple year to date (YTD) measure. But things are not working as expected.
Data Model
dim_date (the weekend column is incorrect, but doesn't affect of principle)
fact
The YTD
measure is defined as the following:
YTD = CALCULATE(
SUM('fact'[value]),
DATESYTD(dim_date[Date])
)
which give me the following incorrect results for YTD.
It looks like instead of calculating the YTD for the weekend and weekday separate.
Given there are16 rows with that have a date that is label as a weekend as well as fact that all of them falls in the same year, I expect the YTD
and value
to be identical in the above.
Interesting enough, if I slightly change the DAX by using the dim_date[Date].[Date]
instead of just dim_date[Date]
, everything just works as expected.
YTD = CALCULATE(
SUM('fact'[value]),
DATESYTD(dim_date[Date].[Date])
)
Can anyone help to explain what is actually going on here?
The example .pbix
file is here:
https://drive.google.com/open?id=1y3ndL7yDE7T4x7Z2bPhMsa-NHRgGzYj0