Forum Discussion
Date Measure
Hi NJ81858
Please try the formula
DATESYTD(DimDate[Date])
DATESYTD function (DAX) - DAX | Microsoft Learn
Best regards
Michael
-----------------------------------------------------
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your thumbs up!
@ me in replies or I'll lose your thread.
- Mikelytics3 years agoResident Rockstar
Another option could be:
DATESBETWEEN= var _lastdate = -> your code var _firstdate = -> your code RETURN DATESBETWEEN(Dates[Date],var _firstdate,var _lastdate)DATESBETWEEN function (DAX) - DAX | Microsoft Learn
Best regards
Michael
-----------------------------------------------------
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your thumbs up!
@ me in replies or I'll lose your thread.
- NJ818583 years agoHelper IV
When I try the DATESYTD function and put it in a table, it gives me the error that says "Calculation error in measure: A table of multiple values was supplied where a single value was expected."
When I try the DATESBETWEEN function, it only returns the first value in the date table, that being, 1/1/2022, no matter what month I choose as my 'Selected Month' that the end date is supposed to be based on.
- Mikelytics3 years agoResident Rockstar
Hi NJ81858 ,
Yes, because you have to use it in combination with a calculation function. Because also with your current measure you want to calculate something else in the end, right?In the end it would look like this (example)
DATESBETWEEN and Calculation = DATESBETWEEN= var _lastdate = -> your code var _firstdate = -> your code RETURN CALCULATE( SUM(Table[Column]), DATESBETWEEN(Dates[Date],var _firstdate,var _lastdate) )If this dopes not help you then it would be helpful to get the full picture of want you intend to achive. You want a list of YTD dates but this is not the end right?
I assume you want to do a YTD calculation with a specific value. SO having a picture of the data model or some more contect would be good. 🙂
Best regards
Michael
-----------------------------------------------------
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your thumbs up!
@ me in replies or I'll lose your thread.