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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Convert Excel formula to Dax: 'If date between any of multiple date ranges'

Hello, I've been lurking on this forumn for a few days now to find a solution but haven't been able to. I hope this is the right place to post this.

 

For context, I'm trying to create a flag. I have multiple sheets with start times and end times, and then a column with whether or not my schedule was interupted. 

 

I found this thread on ExcelForum, which describes my issue almost exactly: If date between any of multiple date ranges [SOLVED]

 

This code worked for the original poster, but I have no idea how I'd convert this to DAX:

=SUMPRODUCT(($D1>=TEXT($A$2:$A$7,"HH:MM")*1)*($D1<=TEXT($B$2:$B$7,"HH:MM")*1))

 

I'd also have on extra column for a third condition (e.g. was an emergency patient brought to the hospital during the operation), but I've been able to do that. I'm just clueless when it comes getting the dates to work.

 

Any help in guiding me in the right direction would be much appreciated, thank you.

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous ,

I have created a simple sample, please refer to it to see if it helps you.

Measure = SUMX(SUMMARIZE('Table','Table'[sub],'Table'[a],'Table'[b]),'Table'[a]*'Table'[b])

vrongtiepmsft_0-1680141714052.png

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

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

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.