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
justinblackmor
Regular Visitor

LookUp a value based on a column value between two columns in unrelated table

How can I return a value from Table B based on the account number in Table A being between a range set in Table B. 

 

Table A:

justinblackmor_0-1615239980235.png

 

Table B:

justinblackmor_2-1615240057065.png

 

 

I want to create a column in Table A returnining values from the "Class" column in Table B based on the account number from Table A falling in the range of Table B's "SEG 3 BEgin" and "SEG 3 End". For example, I want the value "Operating Expense" returned for a Table A account "4005". 

 

 

1 REPLY 1
dedelman_clng
Community Champion
Community Champion

Hi @justinblackmor -

 

Try creating a column on Table A with this kind of DAX pattern

 

Class =
VAR __ThisRow = TableA[Account]
VAR __minAcc =
    MAXX (
        FILTER (
            ALL ( TableB ),
            __ThisRow >= TableB[SEG3 Begin]
                && __ThisRow <= TableB[SEG 3 End]
        ),
        TableB[SEG 3 Begin]
    )
VAR __maxAcc =
    MINX (
        FILTER (
            ALL ( TableB ),
            __ThisRow >= TableB[Seg 3 Begin]
                && __ThisRow <= TableB[Seg 3 End]
        ),
        TableB[Seg 3 End]
    )
RETURN
    LOOKUPVALUE (
        TableB[Class],
        TableB[Seg 3 End], __maxAcc,
        TableB[Seg 3 Begin], __minAcc
    )

 

Hope this helps

David

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.