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
LD1
Helper III
Helper III

Rename automatically fields in all PowerBI report (ex: N=2023 etc.)

Hi Powerbi's World !

 

I have basic question :

Is it possible to rename automatically several fields by year ? 

For instance, we are in 2023.

I have fields " Turnover N" , "Turnover N-1" etc. 

I replace names of them everytime  by "2023", "2022", etc. 

It's very long to do that and i am going to be bothered next year when N becomes 2024, N-1 becomes 2023, etc.

Have you got some tips? 

 

Thank you in advance and have a good day !

2 REPLIES 2
technolog
Super User
Super User

I hope this message finds you well. I've noticed that this solution remain unresolved. If any of you have managed to find a resolution to the issue, I kindly request that you share your solution for the benefit of the entire community. Alternatively, if you're still facing challenges, please do let us know as well.

Your insights and updates will greatly assist others who might be encountering the same challenge.

ValtteriN
Super User
Super User

Hi,

You can use tabular editor scripting to do this. For example:

ValtteriN_5-1693302689934.pngValtteriN_6-1693302704638.png

 

Now open C# scripts:

ValtteriN_7-1693302722203.png

 



var FromString = "N"; var ToString = "2023"; foreach (var m in Model.AllColumns) { m.Name = m.Name.Replace(FromString,ToString); /* Cycle over all columns in model and replaces the FromString with the ToString */ }

Run the script:

 

Save changes and go back to model:

ValtteriN_8-1693302793041.png

 

We can see the names have changed. Next year you can repeat this but replace N in the script with 2023 and 2023 with 2024.

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/

ValtteriN_4-1693302588606.png

ValtteriN_3-1693302552785.png

ValtteriN_2-1693302525819.png

ValtteriN_0-1693302266798.png





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.