Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-16-2021, 09:02 AM
p45cal's Avatar
p45cal p45cal is offline Remove extra delimiters in power query from merged columns with null values Windows 10 Remove extra delimiters in power query from merged columns with null values Office 2019
Expert
 
Join Date: Apr 2014
Posts: 956
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default


try:
Code:
Result = Table.RemoveColumns(Table.AddColumn(Table.CombineColumnsToRecord(PreviousStep,"merged",{"Hdr1","Hdr2","Hdr3","Hdr4","Hdr5","Hdr6"}), "Custom", each Text.Combine(List.RemoveNulls(Record.ToList([merged])),";")),{"merged"})
where {"Hdr1","Hdr2","Hdr3","Hdr4","Hdr5","Hdr6"} is the list of column headers you want to merge and Custom is the name of the resultant column. The header merged can be anything as long as it is the same throughout; it really doesn't matter what it's called since it's created then deleted in the same line (of course it mustn't be the same as another pre-existing column name).


There are probably better/more elegant ways!
Reply With Quote
  #2  
Old 02-16-2021, 09:48 AM
p45cal's Avatar
p45cal p45cal is offline Remove extra delimiters in power query from merged columns with null values Windows 10 Remove extra delimiters in power query from merged columns with null values Office 2019
Expert
 
Join Date: Apr 2014
Posts: 956
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

Quote:
Originally Posted by p45cal View Post
There are probably better/more elegant ways!
eg. with:

Code:
Result = Table.AddColumn(PreviousStep, "Custom", each Text.Combine(List.Select({[Hdr1],[Hdr2],[Hdr3],[Hdr4],[Hdr5],[Hdr6]}, each _<> "" and _ <> null),";"))
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove delimiters in merged columns in power query when null Marcia Excel 2 11-06-2020 09:42 PM
Power Query to combine multiple tables of unequal number of columns ProudLiberal Excel 1 01-07-2020 07:54 PM
Remove extra delimiters in power query from merged columns with null values How to unmerge all merged cell and fill them with the merged values? Bumba Excel Programming 1 11-10-2019 11:36 AM
Query and Power Query not working Excel 2016 bl10 Excel 0 07-22-2016 06:25 PM
Remove extra delimiters in power query from merged columns with null values Display Null Values in Pivot as 0 lornalou Excel 2 06-02-2016 10:39 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:31 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft