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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Community Champion
Community Champion

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors