March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
DATESYTD(<dates> [,<year_end_date> <--- MEASURE GOES HERE])
Solved! Go to Solution.
Hey Aikarauta,
As far as I know, unfortunately it's not possible to make it dynamic 😞 so what I suggest is to create your own DATESYTD function, like this:
MY_YTD =
VAR FiscalYearEndMonth = 1
VAR EndDate = MAX('Calendar'[Date])
VAR StartDate = IF(
DATE(YEAR(EndDate),FiscalYearEndMonth+1,1) < EndDate,
DATE(YEAR(EndDate),FiscalYearEndMonth+1,1),
DATE(YEAR(EndDate)-1,FiscalYearEndMonth+1,1)
)
RETURN
CALCULATE(<Your Measure>,DATESBETWEEN('Calendar'[Date],StartDate,EndDate))
So you can set the variable "FiscalYearEndMonth" to the month number of your Fiscal Year End Month, basically 1 means '01/31/2020', 2 means '02/29/2020' and so on...
Depending of your data model, I don't know if it would require a little effort to apply it but you can give it a try 😅
Any question, just let me know.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Regards,
Gian Carlo Poggi
Hey Aikarauta,
As far as I know, unfortunately it's not possible to make it dynamic 😞 so what I suggest is to create your own DATESYTD function, like this:
MY_YTD =
VAR FiscalYearEndMonth = 1
VAR EndDate = MAX('Calendar'[Date])
VAR StartDate = IF(
DATE(YEAR(EndDate),FiscalYearEndMonth+1,1) < EndDate,
DATE(YEAR(EndDate),FiscalYearEndMonth+1,1),
DATE(YEAR(EndDate)-1,FiscalYearEndMonth+1,1)
)
RETURN
CALCULATE(<Your Measure>,DATESBETWEEN('Calendar'[Date],StartDate,EndDate))
So you can set the variable "FiscalYearEndMonth" to the month number of your Fiscal Year End Month, basically 1 means '01/31/2020', 2 means '02/29/2020' and so on...
Depending of your data model, I don't know if it would require a little effort to apply it but you can give it a try 😅
Any question, just let me know.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Regards,
Gian Carlo Poggi
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
123 | |
85 | |
85 | |
70 | |
51 |
User | Count |
---|---|
205 | |
157 | |
97 | |
79 | |
69 |