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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
dhorti
Regular Visitor

Merge columns by name ( if the column name contain the setted text)

Hi All

Please help me.

Can I merge columns in the Query editor by column name (if the colname contain the setted text)?

And how can i do?

 

I would like to merge the columns (in the query editor), which name started with "LinkedStore" string. And this "LinkedStore_* " columns number is dinamically changing.

 

For example:

MergedLinkedStoreColumn.jpg

 

 

I saw in the advance editor, and combine the following but... 😞

let
    Source = #"HUData (2)",
    ColNames = Table.ColumnNames(Source),
    TransformCommand = List.Transform(ColNames, each {_, type text}),
    #"Changed Type1" = Table.TransformColumnTypes(Source, TransformCommand),
    #"Merged Columns" = Table.CombineColumns(#"Changed Type1", ColNames,Combiner.CombineTextByDelimiter("", QuoteStyle.None),"Merged")
in
    #"Merged Columns"

Thanks a lot

1 REPLY 1
Eric_Zhang
Microsoft Employee
Microsoft Employee

@dhorti

Instead of merge columns, I'd suggest you do a "unpivot".

Capture.PNG

 

Then unpivoted data model are more normalized and it is easy to get the "merged" column in a visual by using a measure. See more details in the attached pbix.

 

merged values = CONCATENATEX('Table','Table'[Value],",")

Capture.PNG

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.