Conditional Formatting By Font Color In Power BI

Introduction

 
In a previous article, I have explained what condition formatting is.
 
Here in this article you will see how to apply conditional formatting by font color.
 
To do this, I have imported an Excel sheet having employee data. Conditional formatting by font also has three types, just like background color,
  1. Color Scale
  2. Rules
  3. Field Value
Conditional Formatting By Font Color In Power BI
 
To apply this font formatting please follow the below steps.
 
Step 1
 
Import your data into Power BI. I have imported excel data. See the below image.
 
Conditional Formatting By Font Color In Power BI 
 
Step 2
 
To open conditional formatting right click on the column where you apply the condition and click on ‘Conditional Formatting’ and further click on ‘Font color’.
 

Color Scale

 
First I am using the ‘Color Scale’ and showing the employee name in a different color as per their salary.
 
So, right click on ‘ename’ and open conditional formatting by font color.
 
Conditional Formatting By Font Color In Power BI 
 
Once you click on ‘Font color’ a new window will be opened. Select ‘Color Scale’ in ‘Format by’ in the drop down menu. For ‘Based on field’ option select salary column; i.e. ‘Sal’ in my case, as I would like to show the employee name in different color as per their salary. Apply on ‘Values only’, Choose ‘Sum’ in summarization and default formatting ‘As zero’. Also you can select any color as per your choice for lowest and highest value.
 
Conditional Formatting By Font Color In Power BI 
 
You can also add color for middle value by clicking on ‘Diverging’ check box.
 
Conditional Formatting By Font Color In Power BI 
 
Click on ‘OK’ to apply formatting. Your data will be shown like in the below image.
 
Conditional Formatting By Font Color In Power BI 
 
You can sort data by ‘sal’ by clicking on extention(...) right above the table visualization of data.
 
Conditional Formatting By Font Color In Power BI 
 

Rules

 
Before applying another kind of formatting remove the conditional formatting that is already applied.
 
Conditional Formatting By Font Color In Power BI 
 
Conditional Formatting By Font Color In Power BI 
 
Select format by as ‘Rules’ and based on field as ‘Sum of Sal’. By default there will be only one rule, to add another click on ‘New rule’. I am adding 3 rules. See the below image.
 
Conditional Formatting By Font Color In Power BI 
 
Click on “OK’ to apply formatting.
 
Conditional Formatting By Font Color In Power BI 
 

Field value

 
If you want to format by ‘Field value’ than make sure your table contains a column that has color name. As in my table there is no such column so I will add a column according to my task.
 
To add column, go to ‘Modeling’ tab and click o ‘New Column’ apply the below formula.
 
EnameColor = SWITCH(TRUE(), Employee[sal]<=10000, "red", Employee[sal]<=20000, "yellow", "green")
 
Conditional Formatting By Font Color In Power BI 
 
Now open conditional formatting for ‘Ename’ and select ‘Field value’ in format by option. Based on field should be your newly added column i.e. ‘enameColor’ in my case.
 
Conditional Formatting By Font Color In Power BI 
 
Click on ‘OK’ to apply formatting. Your table data will be shown as below image
 
Conditional Formatting By Font Color In Power BI 
 
Step 3
 
To save your file go to ‘File’ tab and click on ‘save as’. Give the path where you want to save and add name to the file. Your file will be saved with “.pbix”extension.
 

Summary

 
These are the simple steps to apply conditional formatting by Font color. Hope you understand these steps. Thanks for reading. Have a nice day.


Similar Articles