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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Pragadeesh
Frequent Visitor

Can we have dynamically changing columns in a Power BI table?

Hi, I have a requirement to dynamically change year columns in a table.

I am looking to create calculated columns with dynamically changing titles. Eg. '2024 Review' for this year, dynamically change to '2025 Review' next year and so on.

Is there a way I can achieve this in Power BI?

1 ACCEPTED SOLUTION

Hi @Pragadeesh - Got it, 

Below is the link for your reference: 

Solved: How to dynamically change columns in a Matrix or C... - Microsoft Fabric Community

 

Please try the above approach and let know.

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





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

Proud to be a Super User!





View solution in original post

5 REPLIES 5
v-zhouwen-msft
Community Support
Community Support

Hi @rajendraongole1 , @AnushaSri ,thank you for your quick reply, I will add more.

Hi @Pragadeesh ,

The Table data is shown below:

vzhouwenmsft_0-1718598739870.png

Please follow these steps:

1.Unpivot the following columns.

vzhouwenmsft_1-1718598826489.pngvzhouwenmsft_2-1718598838655.png

2.Use the following DAX expression to create a table

Table 2 = ADDCOLUMNS({YEAR(TODAY()) & " " & "Delivery",YEAR(TODAY()) - 1 & " " & "Delivery",YEAR(TODAY()) - 2 & " " & "Delivery"},"Year",VALUE(LEFT([Value],4)))

vzhouwenmsft_3-1718598981537.png

3.Create a relationship between two tables

vzhouwenmsft_4-1718599200409.png

4.Final output

vzhouwenmsft_5-1718599266338.png

 

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

AnushaSri
Resolver II
Resolver II

Hi Pragadeesh,

If I correctly understood, you are trying to create a calculated column for dynamically changing year names.

For this you can try this calculation based on any of the date/year column of the table as below.

Add a Calulated Column to your table using the below DAX sample.

DynamicYear = SWITCH(TRUE(),
                DimDate[Year] = YEAR(TODAY()), CONCATENATE(DimDate[Year], " Review (This Year)"),
                DimDate[Year] = YEAR(TODAY())-1, CONCATENATE(DimDate[Year], " Review (Previous Year)"),
                CONCATENATE(DimDate[Year], " Review"))

The result will be like this.

AnushaSri_0-1717581829530.png


Please accept this a a solution if it helps to resolve your issue. also please give Kudos.

Thanks in advance 🙂 

rajendraongole1
Super User
Super User

Hi @Pragadeesh - Create a DAX measure to calculate the current year. This measure will give you that the column titles are always based on the current year.

 

CurrentYear = YEAR(TODAY())

 

Now you can create a Calculated column or new column that generates the dynamic column title based on the current year.

 

DynamicTitle =
VAR CurrentYear = YEAR(TODAY())
RETURN
CONCATENATE(CurrentYear, " Review")

 

Use this measure Dynamic title in your table chart title (fx) and choose

 

rajendraongole1_0-1717579404953.png

 

rajendraongole1_1-1717579548198.png

 

It works, Please check.

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





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

Proud to be a Super User!





Hi @rajendraongole1 , thank you for the response.

But the requirement I'm facing is to dynamic change column names and not the table name. Please find the attached table below

Pragadeesh_0-1717581735728.png


The delivery year should change with every passing year.

Hi @Pragadeesh - Got it, 

Below is the link for your reference: 

Solved: How to dynamically change columns in a Matrix or C... - Microsoft Fabric Community

 

Please try the above approach and let know.

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





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

Proud to be a Super User!





Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.