DATESBETWEEN Function (DAX)
Returns a table that contains a column of dates that begins with the start_date and continues until the end_date.
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.
The DATESBETWEEN function is provided for working with custom date ranges. 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.
The following sample formula creates a measure that calculates the 'Summer 2003 sales' for the Internet sales.
To see how this works, create a PivotTable and add the field, CalendarYear, to the Row Labels area of the PivotTable. Then add a measure, named Summer 2003 Sales, using the formula as defined in the code section, to the Values area of the PivotTable.
=CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]), DATESBETWEEN(DateTime[DateKey], DATE(2003,6,1), DATE(2003,8,31) ))