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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
kteigen
New Member

Check if Date is between a Start & End date on Multiple Rows

Hi all,

 

I have a Fact table that has multiple rows each with their own Start & End date. I also have a Date table, and I want to add a column which checks to see if that Date is included in any of the start/end dates of the Fact table.

 

For instance, here's my Fact table:

kteigen_1-1677629588564.png

 

And here's the Custom Column I'm trying to add to the Date table: 

kteigen_4-1677629838519.png

 

 

So, if Ralph is working from 1/1/23 to 1/8/23, I want all those dates to show as "Yes" on the "Date"[IsAnybodyWorking?] column. I was hoping the formula I had would work but I'm getting a the Expression.Error shown in the 2nd screenshot.

 

What I hope to end up with is a final count of any days where at least 1 employee is working (based on the start & end dates on the Fact table). I've also tried solving for the problem in DAX with a new column in the data model, but didn't have any more luck with that approach. Any tips or tricks are greatly appreciated!

 

 

1 REPLY 1
wdx223_Daniel
Super User
Super User

=if Table.Contains(Fact,_,(x,y)=>x[Start Date]<=y[Date] and x[End Date]>=y[Date]) then "Yes" else "No"

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Top Solution Authors