- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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],
DATESYTD('Date'[Date],"31/03")
)
But as you can see, the YTD function starts on April as intended then resets on January 2021? Why is that ?
My fact table Date column is joined with my Date table on Date key .
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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
If this post helps, please consider accept as solution to help other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi,
Your measures are correct. Just that you can simplify Amt_Sum to
=-1*(SUM(sql[AMT]))
I suspect there is a problem with the relationship. Share the link from where i can download your PBI file.
Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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
If this post helps, please consider accept as solution to help other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

@Anonymous here is what you need to change:
YTD =
CALCULATE(
[AMT_SUM],
DATESYTD('Date'[Date],"3/31")
)
✨ Follow us on LinkedIn
Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hello, 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")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hello, DATESYSTD will return a column with the dates up to now. What you want I think is TOTALYTD.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Tried this but doesnt work
YTD =
TOTALYTD(
[AMT_SUM],
'Date'[Date],
ALL('Date'),
"3-31"
)

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
01-26-2025 08:33 AM | |||
09-04-2024 06:15 AM | |||
12-06-2021 10:23 AM | |||
10-20-2024 11:58 PM | |||
10-15-2024 04:54 AM |
User | Count |
---|---|
83 | |
79 | |
53 | |
39 | |
37 |
User | Count |
---|---|
104 | |
85 | |
47 | |
43 | |
42 |