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
Anonymous
Not applicable

Look up a number to see if it's between two numbers in diff table

Hi!

I have 2 tables below.

 

Table 1

TypeFirstLast
A13
B710
C1215

 

Table 2

NumberReturned Column
2A
12C
5 

 

The red column is the column I want returned.

Essentially, I want to check if the "Number column" in Table 2 is between "First" and "Last" columns in Table 1. If it is between the 2 values, I want it to return the Type column from Table 1.

Hope this makes sense, any help appreciated!

4 REPLIES 4
amitchandak
Super User
Super User

Try

maxx(filter(table2,table2[Number]>=table1[First] && table2[Number]<=table1[Last]),table1[Type])
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
Anonymous
Not applicable

Hi Amit - You replied on top of my DAX option... does that mean my formula does not work and that's why you gave another option?

 

Thanks

Anonymous
Not applicable

Hi there - 

 

I have created Table1 with the exact same data you provided and Table2 was created as follows:

1. Table2 was created with just 1 column with that data you have.

2. Second column is a calculated column with the following DAX code and it worked fine for me.

 

Please check at your end, and if it works for you as well please let me know.

Capture_New.PNG

 

The code is here:

resultColumn =
VAR numberValue = Table2[Number]

RETURN
CALCULATE(
SELECTEDVALUE(Table1[Type]),
numberValue >= Table1[First], numberValue <= Table1[Last]
)

Regards

E

Anonymous
Not applicable

Hi!

I'm fairly certain that yours would work. I am have trouble with memory and it is unable to complete the calculation for the column...

 

Thank you though!

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.