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
Anonymous
Not applicable

how to change a list value to text

Hi, everyone, please help on this, I need table columnname as text, when I use this : Table.ColumnNames(table1)

it will show the value with list type. how can I CONVERT this list to text, thank you very much

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous,

 

You can refer to below steps if it suitable for your requirement.

 

let
    Source = Excel.Workbook(File.Contents("C:\Users\xxxxx\Desktop\test.xlsx"), null, true),
    Sales_Sheet = Source{[Item="Sales",Kind="Sheet"]}[Data],
    #"Promoted Headers" = Table.PromoteHeaders(Sales_Sheet),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Month", Int64.Type}, {"Year", Int64.Type}, {"Amount", Int64.Type}}),
    Custom= Lines.ToText(Table.ColumnNames(#"Changed Type"),",")
in
    Custom

 

 

Screenshots:

Capture.PNGCapture2.PNG

 

Regards,

Xiaoxin Sheng

View solution in original post

3 REPLIES 3
Rickmaurinus
Helper V
Helper V

One way is to use the Text.Combine function by writing: 

 

Text.Combine(Table.ColumnNames(#"Changed Type"),",")

 

If you only want the first item you could also use: 

 

 

List.First(Table.ColumnNames(#"Changed Type"),",")

 

Hope that helps!

Rick

--------------------------------------------------

@ me in replies or I'll lose your thread

 

Master Power Query M? -> https://powerquery.how

Read in-depth articles? -> BI Gorilla

Youtube Channel: BI Gorilla

 

If this post helps, then please consider accepting it as the solution to help other members find it more quickly.

Anonymous
Not applicable

Hi @Anonymous,

 

You can refer to below steps if it suitable for your requirement.

 

let
    Source = Excel.Workbook(File.Contents("C:\Users\xxxxx\Desktop\test.xlsx"), null, true),
    Sales_Sheet = Source{[Item="Sales",Kind="Sheet"]}[Data],
    #"Promoted Headers" = Table.PromoteHeaders(Sales_Sheet),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Month", Int64.Type}, {"Year", Int64.Type}, {"Amount", Int64.Type}}),
    Custom= Lines.ToText(Table.ColumnNames(#"Changed Type"),",")
in
    Custom

 

 

Screenshots:

Capture.PNGCapture2.PNG

 

Regards,

Xiaoxin Sheng

MattAllington
Community Champion
Community Champion

Can you please provide an example. It is not clear from your post



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.

Top Solution Authors