Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
chilton
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? 

 

chilton_0-1670277625620.png

 

1 ACCEPTED SOLUTION
v-yinliw-msft
Community Support
Community Support

Hi @chilton ,

 

You can try this method:

Sample data:

vyinliwmsft_0-1670294294694.png

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:

vyinliwmsft_1-1670294404028.png

vyinliwmsft_2-1670294417951.png

For more information about this function, you can refer this method:

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.

 

View solution in original post

1 REPLY 1
v-yinliw-msft
Community Support
Community Support

Hi @chilton ,

 

You can try this method:

Sample data:

vyinliwmsft_0-1670294294694.png

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:

vyinliwmsft_1-1670294404028.png

vyinliwmsft_2-1670294417951.png

For more information about this function, you can refer this method:

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.

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.