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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
dia612
Helper IV
Helper IV

Dynamically changing name ofthe column header

Hello,

In Power BI,

We can dynamically change the title name  using measure in Format > Title > fx

But is there a way , I can change name of the column Header also  dynamically using the measure??

 

 

 

1 ACCEPTED SOLUTION

Hi @dia612,

It means you can create a list with the column names you wanted, then you can invoke them in your query table with 'renamecolumns' function to dynamic rename current column names:

Columnname stored a list of column names strings

let
    Source = {"id","name","desc"}
in
    Source

Query table invokes above list to rename fields:

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

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

4 REPLIES 4
v-shex-msft
Community Support
Community Support

HI @dia612,

You can try to create a list with column names and invoke it in query table steps to dynamic rename your columns on the query editor side.

>>But is there a way , I can change name of the column Header also  dynamically using the measure??

Nope, measure formulas impossible to interact with data model fields dynamically. (its source are generated from data model tables, you can't use child level to effect its parent)

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hello @v-shex-msft ,

 

Thankyou for taking time for replying.

I did not understand your suggestion clearly

"You can try to create a list with column names and invoke it in query table steps to dynamic rename your columns on the query editor side"

 

Could you please explain it with example

Hi @dia612,

It means you can create a list with the column names you wanted, then you can invoke them in your query table with 'renamecolumns' function to dynamic rename current column names:

Columnname stored a list of column names strings

let
    Source = {"id","name","desc"}
in
    Source

Query table invokes above list to rename fields:

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

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.