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
Hernán
Frequent Visitor

Dynamic change column name according current month - DAX or Power Query

Hello everyone!

 

I hope you are doing great!

 

I have working in a table that it going to change every current month.

 

Image1. Table with the column name M+1 +M+2...M+n

Current tableCurrent table

Currently, I changed the column name thus:

Image2. Manual rename change for columns:

Columns renamedColumns renamed

Eg: If the current month is november, 2022, thus:

M+1 will be =December, 2022, M+2 will be = January, 2023... thus M+12 will be November, 2023

Eg: If The next month will be December, 2022 thus:

M+1 will be January, 2023, M+2 will be = February, 2022... M+12 will be December, 2023

 

 

How can I change it dynamically?, How can I use DAX or Power Query for to achieve that rename in the columns?

I expected:

Column names that I expectedColumn names that I expected

Attached:

Thank you so much for your help!

 

Regards,

Hernán Montoya

 

2 REPLIES 2
Hernán
Frequent Visitor

Hello @v-yangliu-msft  thank you for your reply!

The solution you sent me isn't useful for my case. Thank you for the recommendation!.

Do you know if is possible to create a calendar table and associate future month with a specific column name or something similar?

Eg. If I create a calendar table and I use a similar function as DATEADD but in the future for to create to relationship between future months and my columns name (M+1 = current month + 1 futuremonth, M+2 = current month + 2 future months ...)

Thank you so much for your help!

 

Best regards,

Hernán Montoya

v-yangliu-msft
Community Support
Community Support

Hi  @Hernán ,

 

You cannot have dynamic names for a measure or column. But you can have dynamically measures to be displayed in a table visuals. Basically the field will change based on the measure you selected in a slicer. 

Dynamic Measure Selection in Power BI - Visual BI Solutions

28 - Change Column name Dynamically on Visuals in Power Bi - YouTube

 

Best Regards,

Liu Yang

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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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