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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
venegasmi
Frequent Visitor

How to add column from other table based on ranges?

I have 2 tables, Accounts and Info.

 

Accounts Table looks like this, only with millions of rows:

FromToAccount Type
100156120211ABC Account
432215554532XYZ Account


And Info Table looks like this, only with millions of rows:

Irrevelant Columns for this questionAccount
irrelevant data for this question113456
irrelevant data for this question498777


I need to append 'Account Type' column from 'Accounts' table, over to 'Info Table' based on the values of 'From' and 'To'.
Therefore obtaining  this:


Ideal Info Table

 

Irrevelant Columns for this questionAccountAccount Type
irrelevant data for this question113456ABC Account
irrelevant data for this question498777XYZ Account


How can I do this?

 

 

3 REPLIES 3
DataInsights
Super User
Super User

@venegasmi,

 

Try this calculated column in the Info table:

 

Account Type = 
VAR vAccount = Info[Account]
VAR vResult =
    MAXX (
        FILTER ( Accounts, vAccount >= Accounts[From] && vAccount <= Accounts[To] ),
        Accounts[Account Type]
    )
RETURN
    vResult

 

DataInsights_0-1651424519906.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi @DataInsights !
It only mapped the last one of the Account Types. For example, out of account types ABC, DEF and XYZ, it only mapped the accounts of type 'XYZ', all the rest of the column were left blank. 

@venegasmi,

 

Would you be able to provide examples? You can paste the data as a table or use a file service like OneDrive.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors