Forum Discussion
Anonymous
5 years agoNot applicable
DATESYTD not working as expected
I'm trying to get YEAR to DATE sum based on a customer financial year. Here are my code snippets: AMT_SUM =
CALCULATE(
SUM(sql[AMT])
)*-1 YTD =
CALCULATE(
[AMT_SUM],
DAT...
- Anonymous5 years ago
HI Anonymous,
Did these formulas help? If not, you can also try to use the date function to manually define the filter ranges to calculate the YTD which is similar to the DATESYTD function.
YTD = CALCULATE ( [AMT_SUM], FILTER ( ALLSELECTED ( sql ), sql[Date] <= MAX ( Calendar[Date] ) && YEAR ( sql[Date] ) = YEAR ( MAX ( Calendar[Date] ) ) ) )Time Intelligence "The Hard Way" (TITHW)
Regards,
Xiaoxin Sheng
samdthompson
Memorable Member
5 years agoHello, just checked the documentation from MS. Looks like the Year end date is best done as a "3/31" rather than "3-31":
In this example, year_end_date can be specified as "6/30", "Jun 30", "30 June", or any string that resolves to a month/day. However, it is recommended you specify year_end_date using "month/day" (as shown) to ensure the string resolves to a date.
Try:
YTD = TOTALYTD([AMT_SUM], Date[Date], "03/31")