Skip to content
Home » Power BI Exercise » Power BI Exercise – Create a Conditional Formatting Rule

Power BI Exercise – Create a Conditional Formatting Rule

5/5 - (2 votes)

Learn how to apply conditional formatting in Power BI by highlighting employees with a performance score above 80 in green and others in red.

This exercise demonstrates how to create and display the rule in a table for easy visual analysis.

Tasks:

  1. Create a rule to highlight employees who scored above 80 in green and others in red.
  2. Display the data in a table with conditional formatting.

Employee Dataset:

EmployeeName PerformanceScore
Alice 85
Bob 70
Charlie 90
David 75
Emma 95
Frank 80
Grace 88
Harry 65
Irene 92
Jack 78
Kelly 85

Solution:

You can save the above data in any file and load it into Power BI Desktop.

Create a rule to highlight employees who scored above 80 in green and others in red:

For this task, we will first add a calculated column for Performance Status. If the employee’s score is greater than 80, we will show High⁣, otherwise, we will show Low.

Right-click on the dataset name and select 'New Column'.

Create new column in Power BI
Create new column in Power BI



After that, write the DAX code below and click on the commit icon (✓).

Performance Status =
IF(Employee[PerformanceScore] > 80, "High", "Low")
Table view in Power BI
Table view in Power BI

Display the data in a table with conditional formatting:

Add a table visual with the EmployeeName and PerformanceScore columns on the report page.

After that, right-click on the PerformanceScore column, go to Conditional Formatting, and select Font Color.

Conditional Formatting
Conditional Formatting

Now select the below options-

Format style: Rules

What field should we base this on?: Select Performance Status column from your dataset.

In the first rule, provide the text 'High' and choose green as the color. Then, click on '+New Rule' to add another rule for 'Low,' choose red as the color, and click the 'OK' button.

Font color - Conditional Formatting
Font color – Conditional Formatting

Now you can see the result: employees who scored above 80 are highlighted in green, while others are highlighted in red.

Conditional Formatting Result
Conditional Formatting Result

I hope you enjoyed this Power BI exercise.

Loading

Leave a Reply

Discover more from Learn BI

Subscribe now to keep reading and get access to the full archive.

Continue reading