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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
chwostian
Frequent Visitor

Why the chart's title background won't change its color on the value of the measure?

Hi guys,

 

I have a chart I want to make its title's background color dependent on the value of a measure. The measure compares two strings:

1. "Years: " & YEAR(NOW())

2. the value of another measure called areFiltersApplied which returns a string of filters applied to the table via slicers 

 

This is how the areFiltersApplied is built:

areFiltersApplied = IF([isYearFiltered], "Years: " & [selectedYears], BLANK()) & IF([isQuarterFiltered], " Quarter: " & [selectedQuarters], BLANK()) & IF([isActivityFiltered], " Activity: " & [selectedActivity], BLANK()) & IF([isGroupFiltered], " Groups: " & [selectedGroups], BLANK()) & IF([isSystemFiltered], " System: " & [selectedSystems], BLANK())
 
It is made up of other measures. If a given column is filtered it selects all the distinct values and concatenates them. Let's break down the measure [selectedYears] as an example:
selectedYears =
var selectedColumn = DISTINCT(VALUES(Drawings[Year]))
var sortedColumn = SAMPLE(COUNTROWS(selectedColumn), selectedColumn, [Year], ASC)
RETURN CONCATENATEX(sortedColumn, [Year] & "", ", ")
 
The final measure that is used to establish a color is this one:
coloredTitle =
var color = IF(("Years: " & YEAR(NOW())) == [areFiltersApplied], "#FFFFFF", "#FFFF00")
RETURN color
 
so it should return either white or yellow color. When I apply the measure to the chart's title background using this
 
chwostian_0-1607418135960.png
 
 

 I don't get the result as expected. I get yellow though the comparison returns true. I used a table to check the value of the coloredTitle measure (see the second red circle). It returns true hence white (#FFFFFF)

 

chwostian_0-1607416796038.png

Can anyone help? What am I missing? Thanks for any hint.

6 REPLIES 6
Anonymous
Not applicable

Hi @chwostian ,

 

Can't reproduce the scenario, please consider to share some sample file to us if you don't have any Confidential Information.

 

Best Regards,

Jay

Hi Jay, can this topic stay open without my reaction until some time next month? Reproducing is not that simple. It is gonna take me a while. I am not sure what the rules are. Please advise. Thank you Jay

Anonymous
Not applicable

Hi @chwostian ,

 

Sure. Normally, topics will stay open unless their owner delete them. Even if the topic is marked as solved, users can still view and reply to it.

 

Best Regard,

Jay

AllisonKennedy
Super User
Super User

Not sure without getting access to the report. What filters are affecting each visual? https://docs.microsoft.com/en-us/power-bi/create-reports/power-bi-report-filter

 

Are you able to mock up with sample data and share report with the same problem? If you turn the card tile visual into a column chart, does that impact the title? If you start adding the other fields to it, does that impact the title? Try converting the card tile slowly into the column chart, and take note of when the title changes from 'white' to 'green'. If it doesn't change, then find the difference between the two charts. Hopefully something in there helps??? 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

chwostian
Frequent Visitor

Hi @AllisonKennedy Allison, the table is the same. Having used coloredTitle in a card (value and title) and in a chart's title I got two different results:

chwostian_2-1607430616730.png

Thanks

AllisonKennedy
Super User
Super User

What is the difference between the table you are using to check and the visual title? 

 

Can you try to use the conditional formatting to change the text of the title, and see what it returns when you use the [coloredtitle] measure? Try it again with the [arefiltersapplied] measure. 

 

It will likely  be some context that is overlooked.


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.