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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
SylwiaK
Frequent Visitor

How to joint two tables based on values

Hello,

could you help me with the following problem?

 

I have two independent tables A and B. In A data is stored with start, end and type of activity. In B data is stored with beginning of some measurement. I want to add a column to B so that it shows the type of activity. The type shall be taken from A based on the beginning, if begininning is between start and end. How to write such query?

Tried: 

= Table.AddColumn(TableB, "Activity Type", each List.First(List.Select(TableA[Type], [Beginning] >= TableA[Start] and [Beginning] <= TableA[End])), type text)

 

but it cannot be executed due to cyclic references.

 

I do not want buffers as I need to sync data often.

 

Best 

Sylwia

1 ACCEPTED SOLUTION

Managed to figure out how to solve the problem - used the solution by @amitchandak but had to change type of data to numeric and then it compared the values correctly 

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@SylwiaK , refer if this can help

Power Query Across Table calculated column: https://youtu.be/InjrmY-LJdA

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak I tried one more time following your tutorial and it almost works 😉

The problem is that the values of columns are not compared, i.e.:

= Table.AddColumn(#"Changed Type", "Custom", each let
col = [Beginning],
_table = Table.SelectRows(glds_export, each [END] <= col),
count = Table.RowCount(_table)
in
count)

 

results in all rows selected...

Three columns are of the type Date/Time.

Would you have any idea how to cope with that?

 

Managed to figure out how to solve the problem - used the solution by @amitchandak but had to change type of data to numeric and then it compared the values correctly 

Hi @amitchandak,

thanks for the response, unfortunately it has the same result - cyclic references error

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.