DATESBETWEEN

The DATESBETWEEN function returns a table containing a single column of dates that begins and ends with the dates included as parameters.

Syntax

DATESBETWEEN(
    dates,
    start_date,
    end_date
)

Parameters
  • dates: Reference to a column that contains dates.
  • start_date: Starting date to consider.
  • end_date: End date to consider.
Returned value

The DATESBETWEEN function returns a table containing a single column.

Additional Information

The dates returned in the function result include the start and end dates.

Examples

We define the following measure by which we calculate sales between January 2, 2007 and January 4, 2007:

Ventas período = CALCULATE(
   [Ventas],
   DATESBETWEEN(
      FactSales[DateKey],
      DATE(2007,1,2),
      DATE(2007,1,4)
   )
)

If we show a table with sales per day and a second "card" type display with the newly calculated Ventas período measure:

DATESBETWEEN function: Example of use

...we can check how only the sales in the corresponding period are added.

Category
Time intelligence
Submitted by admin on Tue, 12/04/2018 - 11:19