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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.