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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
shaileng
Frequent Visitor

Dynamically Change Column Title

Hi,

 

Just wondering on how to achive the following.

 

I have a table which provides the dates to the slicer.

 

Now for each date I have huge data in data base and the column in which I am showing the data is named as "CurrentYear" instead all I want is to use the Year depending on the slicer date so for eg. the slicer says 1-Jan-2018 then the column title should say "Year 2018" and likewise. 

 

Thanks

2 REPLIES 2
Greg_Deckler
Super User
Super User

Another technique for this, depending on your specific scenario, which I am not 100% clear on, would be to create a Measure like:

 

My Year = "Year " & YEAR(MAX([Date]))

 Then you can display this using a Card visualization. With a little formatting, you can often overlay this or use this as a replacement for column titles, etc.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...
itayrom
Resolver II
Resolver II

As far as I know, it is not possible to dynamically change a column's title.

 

I can, however, think of a way you can create an illusion as if that's whats happening, at least in some scenarios-

 

1. Add to your data table or date master table a new column, whose values would be in the form if 'Year <YearNumber>', where <YearNumber> is, obviously, the year part of the date column in the current row.

For example, add a calcuated column called 'RelevantYear' to your date master table with the following DAX expression-

RelevantYear = "Year " & YEAR([Date])

2. Add a matrix visual to your report, put all the categorical data you want to display in its 'Rows' field bucket, put the 'RelevantYear' column in its 'Columns' field bucket, and put the 'CurrentYear' column in its 'Values' field bucket.

 

This will result in 'Year <YearNumber>' columns in the matrix for each year in your data table, showing the data relevant for that year. When you select a date in your slicer, only the relevant 'Year <YearNumber>' for the selected date will be displayed.

 

3. Replace your slicer with a 'Chiclet Slicer' visual, which can be obtained from the custom visuals store, because it allows you to force a selection, basically making it function like a set of radio buttons, thus making only one 'Year <YearNumber>' column visible at any single moment. So add that chiclet slicer to your report, put the dates column in its category bucket, go to the 'General' tab in its 'Format' panel, set 'Multiple selection; to 'Off' and 'Forced selection' to 'On'.

 

Hope this helps!

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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