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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors