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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
vijenkin
Employee
Employee

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.

2 REPLIES 2
cherchaps61
Regular Visitor

I have a problem similar to this...but the solution does not work for me.  I have a column (Projected Date) with nulls for some dates.  However, I do not want to replace all nulls in the column...only nulls for Plant "A", if Status is "D".  The nulls can be replaced with dates from another table.  I have attached the Power BI file...and below is a "mocked up" image of what I need.  

I have tried If, and LookupValue...I am just not getting the syntax correct

 

I would like to include examples, but I cannot see where to add the .pbix file...and if I paste the visual example, I get an error for too many rows.  Please email me so I can send you examples...Cheryl.Chapman@harley-davidson.com

 

calerof
Impactful Individual
Impactful Individual

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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