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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Dom87326
Helper II
Helper II

Merge columns based on condition

Hello Experts!

 

A have a large number of columns per table that end with 'Other'. How can I merge these columns (1 to 2) if the condition (column name to end with 'Other') gets satisfied in power query and new merged column name should be the same as before (i.e. 1)?

The end result ideally should display column 1 name, column 2 value and delete column 2 for all table.

Dom87326_0-1649848490614.png

 

Many thanks in advance!

 

1 ACCEPTED SOLUTION
Vijay_A_Verma
Most Valuable Professional
Most Valuable Professional

Use this. You will need to replace #"Previous Step" and Column1 as per you need.

Then you can right click on 2nd column and Remove column

 

= Table.ReplaceValue(#"Previous Step",each [Column1],each if [Column1]<>null and [Other]<>null then [Column1]&" "&[Other] else [Column1],Replacer.ReplaceValue,{"Column1"})

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Dom87326 ,

 

Could you tell me if @Vijay_A_Verma 's method helps you solve the issue?If it does, kindly Accept it as the solution.

More people will benefit from it. Or if you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

 

Best Regards,
Eyelyn Qin

Vijay_A_Verma
Most Valuable Professional
Most Valuable Professional

Use this. You will need to replace #"Previous Step" and Column1 as per you need.

Then you can right click on 2nd column and Remove column

 

= Table.ReplaceValue(#"Previous Step",each [Column1],each if [Column1]<>null and [Other]<>null then [Column1]&" "&[Other] else [Column1],Replacer.ReplaceValue,{"Column1"})

 

Dom87326
Helper II
Helper II

Hey @Vijay_A_Verma , 

Ideally I'd like to see this merged column with 1st column name from the above: 

Dom87326_0-1649921575325.png

 

Thanks!

Vijay_A_Verma
Most Valuable Professional
Most Valuable Professional

Can you post the result for the screenshot posted?

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.