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
henriquelima
Regular Visitor

column name

how can I get the column name of a table and after that use as a parameter?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, 

 

The important step is:

 

#"Columns" = Table.ColumnNames(#"Changed Type")

 

This is the M code of the example.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i44FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}}),
    #"Columns" = Table.ColumnNames(#"Changed Type")
in
    #"Columns"

Regards.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @henriquelima,

 

You can use Table.ColumnNames in your M code, like this:

 

columns1.png

 

Next, create a new parameter and select Query option in Suggested Values. In Query field you will find your table.

 

columns2.png

 

 

Regards.

Please can you send me the full code of advanced editor to extract the column name? Just have a half picture

Anonymous
Not applicable

Hi, 

 

The important step is:

 

#"Columns" = Table.ColumnNames(#"Changed Type")

 

This is the M code of the example.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i44FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}}),
    #"Columns" = Table.ColumnNames(#"Changed Type")
in
    #"Columns"

Regards.

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.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

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.

Top Solution Authors