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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
konwes97
Frequent Visitor

Replace value from one table to other by id

Hi all,

I have to update values as a preswent in the tables here. i dont have idea how to complete it. 

 

Table 1

col1col2
1null
2null
3

null

4

null

 

Table 2

ColourReplacement
1M
2F
3F
4M

And i want to have this values in my table 1

Table 1

col1col2
1M
2F
3

F

4

M

1 ACCEPTED SOLUTION
V-pazhen-msft
Community Support
Community Support

@konwes97 

You can either merge the table1 and table2 in power query or create a calculate Column = RELATED('Table (2)'[Replacement]). 

 

Replace from another table is pretty complex in terms of logic, you may refer to:

Solved: Power Query - Replace values from another table wi... - Microsoft Power BI Community

 

 

Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
V-pazhen-msft
Community Support
Community Support

@konwes97 

You can either merge the table1 and table2 in power query or create a calculate Column = RELATED('Table (2)'[Replacement]). 

 

Replace from another table is pretty complex in terms of logic, you may refer to:

Solved: Power Query - Replace values from another table wi... - Microsoft Power BI Community

 

 

Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

selimovd
Super User
Super User

Hey @konwes97 ,

 

I think the easiest would be a new calculated column in Table 1 with the following formula:

Replacement =
-- Save the value of col1 in the variable vCol1CurrentRow
VAR vCol1CurrentRow = 'Table 1'[col1]
RETURN
-- Get the value from column 'Table 2'[Replacement] where 
-- 'Table 2'[Colour] equals the value of current row
    CALCULATE(
        MAX( 'Table 2'[Replacement] ),
        'Table 2'[Colour] = vCol1CurrentRow
    )

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

 

hey
Thanks fot help, but the problem is that i need to replace the values, and not to add new. 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors