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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply

Difficulty with formulas

Hi everyone.

I am new in Power BI and experience difficulties.

I have 2 tables.

First one contains one column with unic numbers.

The second one contains 3 columns: number_from, number_to , text_string.

I need to serch the second table and return the text_string if the number is between number_from and number_to.

Please help with DAX formula or data modeling!

 

1 ACCEPTED SOLUTION
HotChilli
Community Champion
Community Champion

If you want a measure, something like this:

MeasureW = VAR _num = SELECTEDVALUE(TableOne[Column1])
RETURN
CALCULATE(MIN(TableTwo[text_string]) , 
  FILTER(TableTwo, TableTwo[number_from] <= _num && TableTwo[number_to] > _num ))

 

You would pull the number column from the first table on to a table visual, then add the measure.

Let me know how it goes.

 

Also, next time please post data and desired result for faster answers.

 

View solution in original post

3 REPLIES 3
HotChilli
Community Champion
Community Champion

If you want a measure, something like this:

MeasureW = VAR _num = SELECTEDVALUE(TableOne[Column1])
RETURN
CALCULATE(MIN(TableTwo[text_string]) , 
  FILTER(TableTwo, TableTwo[number_from] <= _num && TableTwo[number_to] > _num ))

 

You would pull the number column from the first table on to a table visual, then add the measure.

Let me know how it goes.

 

Also, next time please post data and desired result for faster answers.

 

Thanks! Works!

Is there a possibility to do the same in Power Query?

Thanks a lot! Works great!

Do you think it will work for calculated column?

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.