Forum Discussion
Replace Values based on another table
- 1 year ago
joshua1990 So, generally, you would use a Merge query for something like that but hard to know without more information and example data. Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882
Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
hi joshua1990 ,
Thanks for posting in Microsoft Fabric Community,
As suggested by Greg_Deckler Merge Queries would be the common approach in this case.
I have created some sample data and reproduced the sceanrio as below:
1. Created Main table and replacement table as follows:
2. Merged both tables with Product column as key and used Left Outer Join. This creates a column NewValue in Main table.
3. Added a Custom Column:
Expression: if [NewValue] <> null then [NewValue] else [Value]
This replaces values only where NewValue is available.
Remove the original Value and NewValue columns and renamed the new column as Replacedcolumn.
This way we can use Merge Queries and Custom Column to replace values from another table.
Hope this helps. If further assistance is needed please reach out by providing some sample data and also the required output to assist better.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly and a kudos would be appreciated.
Best regards,
Vinay.