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
I see what you mean. In my case I am displaying info in a matrix table, but I am not displaying any sort of date info other than 'current ytd' and 'prior ytd' in the field names.
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
- Anonymous9 years agoNot applicable
Qiuyun - Thank you! That illustration helped me understand. So if I want to do current year and prior year using that function, would I need two separate calendar tables, one containing only the dates for each year?