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
parry2k
Super User
5 years agoAnonymous 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.⚡