Forum Discussion
DATESYTD / time intelligence not working in custom column
- 9 years ago
Hi Anonymous,
DATESYTD() function is used for returning a table that contains a column of the dates for the year to date, in the current context. When you create a measure like below:
=CALCULATE ( COUNTA(NameOfSomething), DATESYTD('Calendar'[Date]) )
And place this measure in a table or matrix, it will return running count values for the year to date. In my sample, I write the measure like below:
Measure = CALCULATE(COUNTA('SalesFact'[ProductID]),DATESYTD('Date'[Date]))
1. The actual count of ProductID for each date is below.
2. When we put the measure into the table, you can see the measure returns running count values until 12-31 then reset. (As we don't set end date of year in DATESYTD() function, the default is December 31)
Best Regards,
Qiuyun Yu
Are you creating a measure.
This formula works in the measure calculation. This measure then dragged and dropped in the table visualization to get your desired output.
Bhavesh - I tried first as a custom column, and it shows 'everthing' (does not filter). When I try as a measure, I get no results (completely null/blank).
- blopez119 years ago
Super User
Are you using a slicer with the Year column from your calandar (date) table?
- Anonymous9 years agoNot applicable
Nope, there are no slicers.
- Anonymous9 years agoNot applicable
You need some kind of slicer or other input to give it a date context. If you don't tell it which year, it will just give you everything. DATESYTD doesn't give you the dates year to date of this year, it gives you all the dates year to date of whatever date context it's plotted against. If you want it to give you the current year's year to date values for today's date, you need to give it that date.