Overview
In this article, we will talk about how we can apply conditional formatting for A Text column in Power BI.
Data fields
We need the end result to be something like what is shown in the below screenshot.
Step-1:
Load the data from the data source into the Power BI. Add tables visual insert the data fields. The table will look like below.
Step 2 :
Add Conditional Columns in PowerQuery
- Now as we need different Icons for different Status Value.
- We have Status Value in the Text column. We can’t apply conditional formatting on Text columns in Power BI directly.
- In order to apply conditional formatting on text columns, we need to create one numeric column which shows different stages in numeric format.
- Let’s create an additional column which will add numeric value.
- We have different Status columns as showing in the above screen.
- Go to Add Column, click on Conditional Column in power query.
- It will Open the Pop Up to add the Conditional Column.
- Add the New Column Name. We are creating numeric value for the Project Status. So, we have added the column name as “Project Status Rank”.
- Then we will add the conditions shown in below screen.
- Then we will screen the conditional column with numeric values.
- In the same way, we will add the conditional columns for Budget Status, Forecast Status, Profit Status.
- All the conditional columns have been created.
Step 3:
Add Conditional Formatting using Icons in Power BI
- Convert all Status column to the Decimal Number data type.
- Select individual status column and go to Modelling from the ribbon and select Datatype = Decimal Number.
Let’s apply Conditional formatting using Icons for Project Status column.
- Left Click on for Project Status Column and click on Conditional formatting.
- Click on Icons
- Set the following values as shown in the screenshot
In the above image
- Format by = Rules
- Based on field = For Project Status, we created numeric column “ProjectStatusrank”. So, we will set “ProjectStatusRank”.
- Summarization = Sum.
- Icon Layout= We want to set the icons left to the text. So, we will set Left of the data.
- Icon alignment = Set Icon alignment as per your wish.
- Style = Select different styles based on your choice. There are so many OOTB icons choose what ever you want.
- Add Rules as shown in the below screen.
- Click on OK.
- The result will look like following screen.
- Now, apply conditional formatting for other columns as well as into Profit Status,Forecast Status,Budget Status.
- The end result will look like in the following screen.