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

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

Reply
dmgebauer
Frequent Visitor

How to identify multiple dates in 1 table to multiple pairs of dates in a 2nd table with conditions

I have two tables, 'TeeTimes' and 'Closures' with data that I would like to compare.

The "Budget Tee Date" in the 'TeeTime' table to see if it falls between the 'Closure' tables "Close Date" and "Open Date". Then put the value of "Closure Type" from the 'Closure' table into the "Open/Close" column of the 'TeeTimes' table or simply the text value "Open" if no conflicts with the closures.

 

Department is a common field in both tables. 

 

Table views

Tables_Markup.png

 

 

 

 

 

 

 

Relationship

Tree_Markup.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Thanks in advance!

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@dmgebauer Maybe:

 

Open/Close Column =
  VAR __Dept = [Dept]
  VAR __Course = [Course]
  VAR __BudgetTeeDate = [Budget Tee Date]
  VAR __Table = FILTER(ALL('Closures'), __BudgetTeeDate >= [Close Date] && __BudgetTeeDate <= [Open Date])
  VAR __ClosureType = MAXX(__Table, [Closure Type])
  VAR __Result = IF( __ClosureType = BLANK(), "Open", __ClosureType)
RETURN
  __Result

  
  

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

@dmgebauer Maybe:

 

Open/Close Column =
  VAR __Dept = [Dept]
  VAR __Course = [Course]
  VAR __BudgetTeeDate = [Budget Tee Date]
  VAR __Table = FILTER(ALL('Closures'), __BudgetTeeDate >= [Close Date] && __BudgetTeeDate <= [Open Date])
  VAR __ClosureType = MAXX(__Table, [Closure Type])
  VAR __Result = IF( __ClosureType = BLANK(), "Open", __ClosureType)
RETURN
  __Result

  
  

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler  Thank you!!

Close! but I will need to have the result based on the matching departments by each specific closure date range. Current formula seems to be applying a closure to all departments not the matching department.

department no match.png

Looks like it is working with this update

Open/Closed =
  VAR __Dept = [Dept]
  VAR __Course = [CourseName]
  VAR __BudgetTeeDate = [Budget Tee Date]
  VAR __Table = FILTER(ALL('Closures'), __Dept = Closures[Dept] && __BudgetTeeDate >= [Close Date] && __BudgetTeeDate <= [Open Date])
  VAR __ClosureType = MAXX(__Table, [Closure Type])
  VAR __Result = IF( __ClosureType = BLANK(), "Open", __ClosureType)
RETURN
  __Result

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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