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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.