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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

Dynamicaly named columns

Hi.

Is there any way how to dynamicaly name column in table or matrix visualisation?

I have simple table - revenue per month:

Month - 2019 - 2018 - 2017

January - 100 - 80 - 60

February - 120 - 120 - 100

...

Data source is generated as data for last 3 years. So in 2019 it's range 2017-2019, in 2020 it will be 2018-2020.

 

But when I name columns as exact years in 2020 I will need to rename it again.

Now i use syntax as:

current  year = YEAR (TODAY())...

current year-1 = YEAR (TODAY())-1...

current year-2 = = YEAR (TODAY())-2...

what is not very nice names of columns looks bad.

 

Any advise?

 

Thx.

 

4 REPLIES 4
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Is this problem sloved? 

If it is sloved, could you kindly accept it as a solution to close this case?

If not, please let me know.

 

Best Regards

Maggie

Anonymous
Not applicable

@v-juanli-msft 

I tried this solution, but it does't work. Maybe I do something wrong. So that's why I didn't accept solution. But if it's a problem I will accept it.

Hi @Anonymous 

Could you share the screenshot of your original dataset when importing into Power BI?

The example of your first post shows the correct data structure as below, right?

month 2018 2019
1 20 20
2 20 20
3 20 20

 

I wonder how you update data (eg, from 2017~2019 to 2018~2020)

do you add new column "2020" with data in the original file and refresh from Power BI to add this data in?

 

Best Regards
Maggie

 

parry2k
Super User
Super User

@Anonymous you just unpivot your data, in advanced editor, select month, right click and then choose unpivot other columns

 

You will get two new colums, attribute and value and rename attribute to year. Apply the changes.

 

Now add matrix visual, put month column on rows, year column on columns and value column on value, and you will have the result.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Top Solution Authors