DATESBETWEEN Function (DAX)

How does the DATESBETWEEN function (DAX) work?

The DATESBETWEEN function (DAX) returns a table that contains a column of dates that begins with the start_date and continues until the end_date.

DATESBETWEEN Formula Syntax

DATESBETWEEN(
     <dates>,<start_date>,<end_date>
)

How do you use the DATESBETWEEN function?

The DATESBETWEEN function is provided for working with custom date ranges.

Related Blog Posts

 

Considerations when using the DATESBETWEEN function

If start_date is a blank date value, then start_date will be the earliest value in the dates column.

If end_date is a blank date value, then end_date will be the latest value in the dates column.

The dates used as the start_date and end_date are inclusive: that is, if the sales occurred on September 1 and you use September 1 as the start date, sales on September 1 are counted.

If you are working with common date intervals such as months, quarters, and years, we recommend that you use the appropriate function, such as DATESINPERIOD.

Related Video Tutorials

Formula examples using the DATESBETWEEN function

=CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]), DATESBETWEEN(DateTime[DateKey], DATE(2007,6,1), DATE(2007,8,31) ))

= CALCULATE(SUM(FactSales[Net_Sales]), DATESBETWEEN(tbl_Calendar[Date_Id], DATE(2016,10,1), DATE(2016,12,31) ))

= CALCULATE ( SUM (Sales[Sales Amount]), DATESBETWEEN (Sales[Date], DATE (2015,1,1), DATE (2015,3,31))

Related DAX Functions

DATESINPERIOD
 
 

Related Course Modules

Ultimate-Beginners-Guide-To-PowerBI