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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Calculated Column Find Number in Range Between two Numbers

Hi,

I have two tables.

Table A looks like this:

NumberRangeFromRangeTo
11700017999
21800018999

 

Table B looks like this:

NumberName
17001Tom
17002Michael
19000Brad

 

I want to create a calculated column in Table B that checks for each number to see if it is in the range and if so, returns a 1.

For 17001 and 17002 1 should be returned, for 19000 a 0.

Currently my calculation looks like this.

 

if(Table_B[Number]>=related(Table_A[RangeFrom]) && Table_B[Number]<=related(Table_A[RangeTo]) ,1,0)

 

Thank you for help!

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Anonymous 
Please use

=
MAXX (
    FILTER (
        'Table A',
        'Table B'[Number] >= 'Table A'[RangeFrom]
            && 'Table B'[Number] <= 'Table A'[RangeTo]
    ),
    'Table B'[Name]
)

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

Hi @Anonymous 
Please use

=
MAXX (
    FILTER (
        'Table A',
        'Table B'[Number] >= 'Table A'[RangeFrom]
            && 'Table B'[Number] <= 'Table A'[RangeTo]
    ),
    'Table B'[Name]
)
Anonymous
Not applicable

Great answer thank you!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.