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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
nehapowerbi
New Member

Power BI Conditional formatting format only one row based on row category

HI, 

I am trying to create a simple Employee table where I have yearly counts for male and female for last few years . I have created a measure to show percentages of male female by year as a measure . I am looking to format percentages as :

 

30%  and below as red

31 % and above as Green  

The problem is I want to achieve this conditional formating logic but want to apply it to  female rows only  (eg : based on the rule %2023parentrow column  I want only 42% to show as green (since its greater than 30% ) and not 58% male as green).  See attached table 

nehapowerbi_1-1681940867747.png

 

 

 

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@nehapowerbi 

You can write a measure to read the gender and return a formatting color for only F.

 

Format Female = 
VAR _Gender = SELECTEDVALUE ( Table[Gender] ) = "F"
RETURN
IF ( _Gender, IF ( [Gender%] > .3, "Green", "Red" ) )

 

Formate the measure as text then apply it as conditional formatting to the % measure.

jdbuchanan71_0-1681942234196.png

My sample data has Female/Male rather than F/M

 

View solution in original post

2 REPLIES 2
nehapowerbi
New Member

 Thank you so much ! This solved my problem 🙂

jdbuchanan71
Super User
Super User

@nehapowerbi 

You can write a measure to read the gender and return a formatting color for only F.

 

Format Female = 
VAR _Gender = SELECTEDVALUE ( Table[Gender] ) = "F"
RETURN
IF ( _Gender, IF ( [Gender%] > .3, "Green", "Red" ) )

 

Formate the measure as text then apply it as conditional formatting to the % measure.

jdbuchanan71_0-1681942234196.png

My sample data has Female/Male rather than F/M

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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