Tutorial with example
In todays video we are going to cover the DAX function DATESBETWEEN.
DATESBETWEEN function allows you to calculate amounts between two dates you specify.
For example, if you want to calculate the sum of sales between two specific dates, this is the perfect function for you.
You can “hardcode” the dates or you can specify the dates dynamically, both options are possible.
DATESBETWEEN DAX function will give the same results as DATESINPERIOD DAX function when you are rolling dates backwards, but the main difference is that DATESBETWEEN allows you to specify a start and end date while DATESINPERIOD allows you to specify an end date and then an interval to roll it backwards.
Download example file:
Download Power BI file: here.
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.
This DAX function is not supported for use in DirectQuery mode.