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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Tybaal
Helper II
Helper II

How to link two tables on date "between" 2 dates

Hi all, 

 

I'd like to link 2 tables on dates with a "between" relation.

I have a "ContractDate" in table 1 and a "ValidDateFrom" and "ValidDateTo" in table 2.

My goal is to create a relation like that :

1.ContractDate BETWEEN 2.ValidDateFrom AND 2.ValidDateTo

 

Is there a way to do that?

 

Thank you in advance.

1 ACCEPTED SOLUTION

@Tybaal 

There is no such between relationship in power bi, you can just link either the fromdate and todate with the ContractDate in manage relationship, and set the conditions with dax in later calculation.

 

Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Tybaal , try like

calculate(countrows(Table1), filter(Table,table1[ContractDate] >= min(table2[ValidDateFrom] && table1[ContractDate] >=table2[ValidDateTo])), values(Table[contract_id]))

or


calculate(countx(values(Table[contract_id]), Table[contract_id]), filter(Table,table1[ContractDate] >= min(table2[ValidDateFrom] && table1[ContractDate] >=table2[ValidDateTo])))

Thank you @amitchandak

My issue is that I have no ID to link both tables... I only have the dates...

@Tybaal 

There is no such between relationship in power bi, you can just link either the fromdate and todate with the ContractDate in manage relationship, and set the conditions with dax in later calculation.

 

Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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