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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
BRUNO1187
Frequent Visitor

Get Maximum value from a column in Table 1 that is less than value in a row from Table 2

I'm working with 2 tables. Table 1 is a list of building levels and their elevations. Table 2 is a list of items and their elevations. I'm trying to create a formula to identify the Maximum value from Table 1 that is less than the elevation value for each row in Table 2. I'm attempting the formula below, but I can't seem to use both tables in the same formula. I'm new to using Power BI so I'm probably going about this the wrong way. I'd appreciate any help.

 

elevation below = Calculate(
    Max('Table1'[ELEVATION],
    Filter('Table1',
    'Table1'[ELEVATION]<'Table2[ELEVATION]
)))

BRUNO1187_2-1695394537266.png

BRUNO1187_0-1695394388342.png

 

 

 

2 REPLIES 2
lbendlin
Super User
Super User

Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Thanks, I'll try to provide a better example. I want to set up a formula to get the Maxiumum column value from Table2[Elevation] that is less than each row of Table1[Elevation], then get the corresponding Table2[Level Name] to populate the Table1[Level Below] column.

 

In the case of the example below, Item1, Item2, & Item3 would have "Level1" as the "Level Below". Item4, Item5, & Item6 would have "Level2" as the "Level Below". Etc.

 

I'd appreciate any help.

 

Table1

ObjectElevationLevel Below
Item18<get from Table2>
Item29<get from Table2>
Item3

7

<get from Table2>
Item415<get from Table2>
Item516<get from Table2>
Item618<get from Table2>
Item727<get from Table2>
Item827<get from Table2>
Item938<get from Table2>
Item1049<get from Table2>

 

Table2

Level NameElevation
Level10
Level210
Level320
Level430
Level540

 

Table1 (EXPECTED OUTCOME)

ObjectElevationLevel Below
Item18Level1
Item29Level1
Item3

7

Level1
Item415Level2
Item516Level2
Item618Level2
Item727Level3
Item827Level3
Item938Level4
Item1049Level5

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors