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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
rainchong7401
Helper III
Helper III

How to add font color or background color

Hi Friends,
How to add font color or background color for every last year.
Kindly assist. 

I've provide my file in the link down below.
https://www.dropbox.com/s/5mzjdamxicrs4ks/TEST--v2.pbix?dl=0

1.png

1 ACCEPTED SOLUTION
SamInogic
Super User
Super User

Power BI allows Values to be formatted based on data, using Conditional formatting.

 

1Conditional Formatting.jpg

In your report, for Measure in the Values property set the Background Colour using Conditional Formatting as shown in the below screenshot.

2Conditional Formatting.jpg

Set the colour as per the condition required, on the Year column as shown in the below screenshot.

3Conditional Formatting.jpg

 

Thanks!

Inogic

Innovative Logic  

Web: www.inogic.com/services/

Blog: http://www.inogic.com/blog

twitter: @inogic

View solution in original post

9 REPLIES 9
SamInogic
Super User
Super User

Power BI allows Values to be formatted based on data, using Conditional formatting.

 

1Conditional Formatting.jpg

In your report, for Measure in the Values property set the Background Colour using Conditional Formatting as shown in the below screenshot.

2Conditional Formatting.jpg

Set the colour as per the condition required, on the Year column as shown in the below screenshot.

3Conditional Formatting.jpg

 

Thanks!

Inogic

Innovative Logic  

Web: www.inogic.com/services/

Blog: http://www.inogic.com/blog

twitter: @inogic

Hi Sam,
You're very good. 
Your solution is straight forward and accurate result.

PBI_Helpline
Helper I
Helper I

Hi,
Based on your attached PBIX, where you have used only one measure but 2 column headers,  and below kind of formatting for 'HEADERS" are not available with specific column, because that will be enabled only if you have more than one measure.

PBI_Helpline_0-1669981737666.png
Above is possible with specific column only if you use more than one measures.
 Since your Meassure is giving values for 2 consecutive years based on selected year in the slicer, it has only one measure, but two fields in Column header well,
and in this case you can use below conditional formatting measure to format values section of your Matrix visual.  it means, Headers can not be formatted with different colors, in this case., if required you can select one single column header color.

PBI_Helpline_1-1669982075407.png

 


Thank You,
I post Interesting Power BI Solutions on below You-tube channel.
https://www.youtube.com/@PowerBIHelpline
Check this out.


 

Hi PBI,
What about I want font color to change instead of Background? 

Yes,
That can be applied on font color as well same way.

PBI_Helpline_0-1669999040512.png

 

Hi PBI,
Where do you put the format measure into and make it look colorful?
Kindly show me the location where do you put the "format" measure.
You may screenshot and show me step by step or,
If possible share your work via google drive or dropbox. 

1.png
This is mine looks ugly and it's not exactly like what you do.
2.png

If you click on the small dropdown arrow on your measure name in values section. like below, you will see conditional formatting option for all the available formattings. Font, background, icons..

PBI_Helpline_0-1670064592785.png

Click on Conditional Formatting > Font> in Format Type select "Field value> Apply to "values and Total" > and in measure section select the new Format measure, which you created for color formatting.


Thank You,
I post Interesting Power BI Solutions on below You-tube channel.
https://www.youtube.com/@PowerBIHelpline
Check this out.

amitchandak
Super User
Super User

@rainchong7401 , Create a measure and use in conditional formatting using field value option

 

bg color = If(Max(Table[Year]) = Maxx(allselected(Table), Table[Year]) -1, "Yellow", "White")

 

How to do conditional formatting by measure and apply it on pie?
https://www.youtube.com/watch?v=RqBb5eBf_I4&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L
https://community.powerbi.com/t5/Community-Blog/Power-BI-Conditional-formatting-the-Pie-Visual/ba-p/...
https://amitchandak.medium.com/power-bi-where-is-the-conditional-formatting-option-in-new-format-pan...

Hi Amit,
What about I want font color to change instead of Background? 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.