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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.