Skip to main content
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Helper III
Helper III

Understanding DATESYTD, DATESBETWEEN and similar functions

I am trying to understand what is happening beneath the surface with functions like DATESYTD and DATESBETWEEN.  The scenario:


  • A measure [Total]
  • A calendar table Calendar with columns Date, Year, Month, Day
  • A matrix with rows Year, Month and value [Total]
  • Some YTD measures (below)

Measure 1 - Using TOTALYTD - ok

Measure 2 - Using CALCULATE and DATESYTD



All three work as expected and produce the expected result.  Curiosity has me wondering how the 2nd and 3rd are doing so relative to the matrix layout.  In my expressions I do not refer to of modify (clear) the filters on Year, Month, Day.  

Given DATESYTD and DATESBETWEEN return a single column table.  

If I wrote the expression using the custom technique with FILTER then I'd need to explicitly clear the filters on those columns or the entire Calendar table. 

I assume DATESYTD and DATESBETWEEN are doing this but is there any documented details on how these functions work?  


Measure 2 = CALCULATE ( [Total, DATESYTD ( 'Calendar'[Date] ) )
Measure 3 = CALCULATE ( [Total], DATESBETWEEN ( 'Calendar'[Date], STARTOFYEAR ( 'Calendar'[Date] ), LASTDATE ( 'Calendar'[Date] ) ) )

Note, am not concerned about the theory of other functions (unless they relate to this topic), am well aware of when and how simple functions like MAX/MIN should be used.


Helper III
Helper III

Giving this a slight bump.  Anyone?

@marcorusso time for the super heros of DAX to have an input? 🙂

Thank you @marcorusso, hit the nail on the head (again!).


Mid-way through the article I was saying to myself "but it works irrespective of Mark as Date table" as that was part of my testing.  Only a couple of paragraphs later did I read about when the Date column is the key in the relationship.


My life feels much more complete now Smiley Very Happy

Helpful resources

Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors