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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Conditional Formatting

Hi,

 

I was trying to implement some conditional formatting on power bi with a data set showing color codes on each cell instead of text. I tried doing it by conditional formatting option in power bi but unable to get desired results. Can someone guide me how i can achieve this in power bi, picture attached below.

 

1 Table - Normal data set

2nd Table - Desired Data table with color code for WFH and Office 

akhandsingh2412_0-1679636751095.png

Any help would be highly appericiated. Thanks

4 REPLIES 4
grazitti_sapna
Super User
Super User

Create Measure for each column in the table Status color =

var selected_status = SELECTEDVALUE('Conditional Formatting'[1_April])

return

if(selected_status= "WFH", "#D5D8DC",

   if(selected_status="Office", "#F4D03F","#FDFEFE"))

 

Right Click on any of the following values and then select conditional formatting

grazitti_sapna_1-1683099524393.png

 

 

Select background under conditional formatting

grazitti_sapna_2-1683099524398.png

 

Select the field value under Format Style and apply to values only. Select the measure you have created for conditional formatting for that column.

rajulshah
Resident Rockstar
Resident Rockstar

@Anonymous 

 

Please create the following DAX measure:

Color Format =
VAR SelectedValue1 =
    SELECTEDVALUE ( 'Table'[ Field] )
RETURN
    SWITCH ( SelectedValue1, "WFH", "Orange", "Office", "Green" )

 

Go to the Conditional Formatting for this measure > go to Background Color > select Field Value > select this measure.
Do the same for the Font Color and you would be able to achieve the same.

 

Please let me know if this didn't work.

Anonymous
Not applicable

Hi, this way we will only get backgound color with text in it. The text is not getting replaced with color by following these steps.

@Anonymous 

Also, give conditional formatting to font color using the same measure.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.