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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
AlessandroBet
Resolver I
Resolver I

Replace value inside a table reading other table

Hi,

i have 2 tables with several columns

Tab1

Col1 Col2 Col3 ....etc

RawA

RawB

 

Tab2

Col1 Col2 Col3 ....etc

RawA

RawB

 

When i match the same value on Tab1 Col1 RowA and Tab2 Col1 RowA have to replace the value on Tab1 Col2 RowA with Tab2 Col2 RowA

 

can anyone help me?

1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @AlessandroBet ,

 

You can create a relationship between two tables and then use the RELATED() function.

Sample data:

Table1

vstephenmsft_1-1668066408198.png

Table2

vstephenmsft_2-1668066422912.png

Relationship:

vstephenmsft_3-1668066544211.png

Add a calculated column with the above fuction to return the Value 2 with the same name in Table 2.

6.png

Modify it to return the Value1 when it is blank.

 

Column = var _v2=RELATED('Table2'[Value2])
return IF(ISBLANK(_v2),[Value1],_v2)

 

 

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-stephen-msft
Community Support
Community Support

Hi @AlessandroBet ,

 

You can create a relationship between two tables and then use the RELATED() function.

Sample data:

Table1

vstephenmsft_1-1668066408198.png

Table2

vstephenmsft_2-1668066422912.png

Relationship:

vstephenmsft_3-1668066544211.png

Add a calculated column with the above fuction to return the Value 2 with the same name in Table 2.

6.png

Modify it to return the Value1 when it is blank.

 

Column = var _v2=RELATED('Table2'[Value2])
return IF(ISBLANK(_v2),[Value1],_v2)

 

 

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

daXtreme
Solution Sage
Solution Sage

That's a job (easy) for Power Query.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.