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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
phchu1226
Helper IV
Helper IV

Issue on rename column dynamically

Hi all,

 

Refer to this post:

https://community.powerbi.com/t5/Desktop/Auto-renaming-columns-based-on-value-in-another-table/m-p/7...

 

I am able to rename the column based on current date,

i.e today = 29/1,  week0 = 28/1 or before

                             week1 = 29/1 - 4/2

                             week2 =5/2 - 11/2

phchu1226_0-1643364483808.pngphchu1226_1-1643364715219.png

Everything is fine before moving to next day...

The renaming part is fine, the column name is renamed correctly but error occur in the "Values" tab as it cant find the columns after renaming..

phchu1226_2-1643364866211.png

 

Any suggestion for fixing this issue or other alternatives to achieve what I need? Thank you in advance!!

 

 

 

6 REPLIES 6
Anonymous
Not applicable

Hi @phchu1226 ,

you are using the column that’s being renamed, but in your Power BI model, you’ve never renamed it. For example, the original column name is “Passengers”, and you’ve never renamed it. Now it’s being renamed at the data source to “NumberOfPasssengers”. In this case, after the column has been renamed at source, your Power BI refresh will be successful, but some visualisations will fail to load.

To solve that, you have two options.

  • The easy one would be to rename, in your Power BI model, the renamed-at-source field, to its original name. In the example above, this means renaming “NumberOfPasssengers” back to “Passengers”. If you do that, all visualisations and DAX calculations will become valid again.
  • The other option is to go over all invalid visualisations and DAX calculations, and edit them to use the new field name.

 

Best Regards

Community Support Team _ Polly

 

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

Hi @Anonymous,

I knew that I can rename back to the original column name to solve this issue..

However, what I want to do is to rename the column name based on the date,

e.g. today is 8/2, the column should be look like below:

phchu1226_2-1644291914894.png

 

Is it possible to do so?? Thanks.

 

@Anonymous,

 

excuse me, is there any update?

Anonymous
Not applicable

Hi @phchu1226 ,

I have found a simuliar post, please refer to it to see if it helps you.

ow to rename column name as current Date dynamically? 

 

let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwtFTSUTJVitUhgmOElWMB5BgaEMuzQOPEAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Year = _t, #"Value " = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Year", Int64.Type}, {"Value ", Int64.Type}}), #"Renamed Columns" = Table.RenameColumns(#"Changed Type", { { "Year", let currentDateTime = DateTimeZone.LocalNow(), currentYear = Number.ToText( Date.Year( currentDateTime ) ), currentMonth = Date.MonthName( currentDateTime ) in currentYear & "-" & currentMonth } } ) in #"Renamed Columns"Best Regards
Community Support Team _ Polly

 

 

 

Best Regards

Community Support Team _ Polly

 

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

 

amitchandak
Super User
Super User

@phchu1226 , Create a column in table and use

Switch( True(),

[Date] < today() -1 , "Week 0" ,

[Date] > today() , "Week " & quotient(datediff([Date], Today(), Day),7) +1

)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak,

 

I had tried this DAX, the result is not what I expected.

I just want to rename the column name based on date.

phchu1226_3-1644292497746.png

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors