Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi everyone,
I have 2 tables and I need to create a column on the second based on values from the first. Some ideia?
table1
START CODE | END CODE | INFO |
7100000 | 7200000 | INFO 1 |
7000000 | 7099999 | INFO 2 |
7300000 | 7399999 | INFO 3 |
table2
ID | Name | NEW COLUMN NEEDED |
7101010 | SOMEONE | INFO 1 |
7302202 | NEW PERSON | INFO 3 |
7033300 | DOG | INFO 2 |
I need to add a new column on table2 that comes from table1[info] using as criteria that Table2[ID] should be between table1[start code] and table1[end code] and then return table1[info] to be placed as a new column on table2.
Important: the ranges table1[start] and table1[end] are uniques.
Thanks.
Solved! Go to Solution.
You could create a calculated DAX Column on table 2 for this. You would could create an ID for your code ranges and add them to your table1. Then with your caclulated column calculate what ID to assign each row and then relate the ID of table1 to the calculated ID of table2 Something like:
VAR RowID = Table2[ID]
VAR FilteredTable =
FILTER('Table1',
AND('Table1'[StartCode] <= RowID,
'Table1'[EndCode] >=RowID
)
)
VAR Result =
CALCULATE(
DISTINCT('Table1'[IDRangeKey]), FilteredTable)
RETURN Result
Once that is created you can access that info column through the newly created relationship
Hi,
Please check the below picture and the attached pbix file.
expected result CC =
SUMMARIZE (
FILTER (
Table1,
Table1[START CODE] <= Table2[ID]
&& Table1[END CODE] >= Table2[ID]
),
Table1[INFO]
)
Hi @hugomatos
Can you please try the below DAX.
Hi @hugomatos,
Thanks for reaching out to the Microsoft fabric community forum.
It looks like you are looking for a way to add a column from one table to another. As @sevenhills, @mdaatifraza5556, @Jihwan_Kim and @d_m_LNK all responded to your query, please go through the responses and mark the helpful reply as solution.
I would also take a moment to thank @sevenhills, @mdaatifraza5556, @Jihwan_Kim and @d_m_LNK for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.
If I misunderstand your needs or you still have problems on it, please feel free to let us know.
Best Regards,
Hammad.
Community Support Team
If this post helps then please mark it as a solution, so that other members find it more quickly.
Thank you.
Hi @hugomatos,
As we haven’t heard back from you, so just following up to our previous message. I'd like to confirm if you've successfully resolved this issue or if you need further help.
If yes, you are welcome to share your workaround and mark it as a solution so that other users can benefit as well. If you find a reply particularly helpful to you, you can also mark it as a solution.
If you still have any questions or need more support, please feel free to let us know. We are more than happy to continue to help you.
Thank you for your patience and look forward to hearing from you.
Hi @hugomatos,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution so that other community members can find it easily.
Thank you.
Hi @hugomatos,
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
Try this, add column to Table2:
Column = SUMMARIZE( FILTER( Table1, Table2[ID] >= Table1[START CODE] && Table2[ID] <= Table1[END CODE]), Table1[INFO])
Output: (Table 2)
Hi @hugomatos
Can you please try the below DAX.
Hi,
Please check the below picture and the attached pbix file.
expected result CC =
SUMMARIZE (
FILTER (
Table1,
Table1[START CODE] <= Table2[ID]
&& Table1[END CODE] >= Table2[ID]
),
Table1[INFO]
)
You could create a calculated DAX Column on table 2 for this. You would could create an ID for your code ranges and add them to your table1. Then with your caclulated column calculate what ID to assign each row and then relate the ID of table1 to the calculated ID of table2 Something like:
VAR RowID = Table2[ID]
VAR FilteredTable =
FILTER('Table1',
AND('Table1'[StartCode] <= RowID,
'Table1'[EndCode] >=RowID
)
)
VAR Result =
CALCULATE(
DISTINCT('Table1'[IDRangeKey]), FilteredTable)
RETURN Result
Once that is created you can access that info column through the newly created relationship
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
9 | |
7 | |
7 | |
6 |
User | Count |
---|---|
21 | |
11 | |
10 | |
9 | |
8 |