cancel
Showing results for
Did you mean:
New Member

## DATES BETWEEN

Hi,

I am new to Power Bi and attempting to learn how to calculate DATESBETWEEN (Status Not Started and Status Completed/Denied).

I feel completely lost.  Can anyone help?

1 ACCEPTED SOLUTION
Community Support

Hi @chilton ,

You can try this method:

Sample data:

Because the function Datesbetween return a table which has a single column, so you should create a table:

``````NotStartedBetweenDenied =
var _Den = CALCULATE(MAX('Table'[Date]), FILTER('Table','Table'[Status] = "Denied"))
var _NOTS = CALCULATE(MIN('Table'[Date]), FILTER('Table','Table'[Status] = "Not Started"))
return
DATESBETWEEN('Table'[Date], _NOTS, _Den)``````
``````NotStartedBetweenCompleted =
var _Com = CALCULATE(MAX('Table'[Date]), FILTER('Table','Table'[Status] = "Completed"))
var _NOTS = CALCULATE(MIN('Table'[Date]), FILTER('Table','Table'[Status] = "Not Started"))
return
DATESBETWEEN('Table'[Date], _NOTS, _Com)``````

The result is:

DATESBETWEEN function (DAX) - DAX | Microsoft Learn

Hope this helps you.

Here is my PBIX file.

Best Regards,

Community Support Team _Yinliw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support

Hi @chilton ,

You can try this method:

Sample data:

Because the function Datesbetween return a table which has a single column, so you should create a table:

``````NotStartedBetweenDenied =
var _Den = CALCULATE(MAX('Table'[Date]), FILTER('Table','Table'[Status] = "Denied"))
var _NOTS = CALCULATE(MIN('Table'[Date]), FILTER('Table','Table'[Status] = "Not Started"))
return
DATESBETWEEN('Table'[Date], _NOTS, _Den)``````
``````NotStartedBetweenCompleted =
var _Com = CALCULATE(MAX('Table'[Date]), FILTER('Table','Table'[Status] = "Completed"))
var _NOTS = CALCULATE(MIN('Table'[Date]), FILTER('Table','Table'[Status] = "Not Started"))
return
DATESBETWEEN('Table'[Date], _NOTS, _Com)``````

The result is:

DATESBETWEEN function (DAX) - DAX | Microsoft Learn

Hope this helps you.

Here is my PBIX file.

Best Regards,

Community Support Team _Yinliw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Announcements

#### 2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

#### Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

#### Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

#### Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.

Top Solution Authors
Top Kudoed Authors