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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Set conditional formatting between fields

Hi,

I would like to change the color of a row if 2 field have the same name for example if I have the table (first name, last name, age) I would like to color of the same color row who has the same first name but the problem is that by using conditionnal formatting I can deal only with values so I have no idea on how to do it or if it is possible.

Could someone help me please.

Thank you.

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

These are two separate measures.

The first one:

Measure = SELECTEDVALUE(Table1[FirstName])

The Index measure:

Index = 
RANKX(ALLSELECTED(Table1),[Measure],,ASC,Dense)

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous ,

 

You can create below measures:

Measure = SELECTEDVALUE(Table1[FirstName])
Index = 
RANKX(ALLSELECTED(Table1),[Measure],,ASC,Dense)

Then, set conditional formatting as below:

6.PNG

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thank you for your answer I tried your measure but it seems like there is a syntax error around the "Index" 

Hi @Anonymous ,

 

What is the error?

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @v-yulgu-msft ,

 

It say that this syntax is incorrectscreen2.PNGhere is my measure  as I follow yours screen1.PNG I tried to put ";" instead of "," inside the RANKX function but it's still not working

Hi @Anonymous ,

 

These are two separate measures.

The first one:

Measure = SELECTEDVALUE(Table1[FirstName])

The Index measure:

Index = 
RANKX(ALLSELECTED(Table1),[Measure],,ASC,Dense)

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @v-yulgu-msft ,

 

Thank you very much, you helped  me a lot solving my problem

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.