cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Microsoft
Microsoft

Replace Values in Column with another Value

Hello I am currently trying to replace values in one column based on set criteria. I did some research and while I see a number of topics that talk about replacing a value in column A if value in column B equals criteria that is not excatly what I am looking for. Allow me to exaplian in further details:

 

I have a large table which constantly refreshes and pulls in new data. This table has data for differnet accounts that are named GenericCompanyX.

 

AccountData 1Data 2
GenericCompany11121343sdfebgerffb
GenericCompany1434455dvgrnbrtgbgfdnr
GenericCompany23452354fegfrgwef
GenericCompany13546t44325wfrgregfegvr
GenericCompany3632432342gthwfgtnbhte

 

I have another table which has the actiual names of the comapny listed in column Account.

 

ComapniesAccount
ActualCompanyName1GenericCompany1
ActualCompanyName2GenericCompany2
ActualCompanyName3GenericCompany3

 

I want to replace the values in column Account in the 1st table with the values in column Comapnies in the 2nd table. So essentially:

 

If [Table1]Account == [Table2]Account

[Table1]Account == [Table2]Companies

 

Which would visually cause table to look like this:

 

AccountData 1Data 2
ActualCompanyName11121343sdfebgerffb
ActualCompanyName1434455dvgrnbrtgbgfdnr
ActualCompanyName23452354fegfrgwef
ActualCompanyName13546t44325wfrgregfegvr
ActualCompanyName3632432342gthwfgtnbhte

 

To be very clear I do not want to create another column in table 1 (i.e. conditional column) as that table has multiple sources and relationships that are already complaicated enough. I did notice that there is the "Replace Values" button but I am not sure if that is a one time action or will it keep replacing values as data is refreshed and pulled into PowerBi. 

 

I will not be able to share the PBIX file or provide screenshots of the actual data for privacy reasons

 

Any help or direction would be greatly appreciated. If this is not possible please feel free to let me know. Thanks.

1 REPLY 1
Highlighted
Continued Contributor
Continued Contributor

Re: Replace Values in Column with another Value

Hi @vijenkin,

 

In the Power Query editor, try using merge Table1 and Table2 on Account so you get the column Companies, then Remove column Account, close and apply. This is the result:

Merge on AccountMerge on AccountExpand  CompaniesExpand CompaniesRemove AccountRemove AccountTableTableVisualVisual

 

This will be refreshed based on the schedule you define in the PBI Service.

Hope it helps.

Regards,

Fernando

 

 

Helpful resources

Announcements
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Don't miss the Power BI Dev Camp this week!

August Community Highlights

Check out a full recap of the month!

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

Top Kudoed Authors