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

Conditional Color format code spot the mistake

Hey guys, could anyone tell me what Im doing wrong in this code that it also colours the first row? it doing fine with the rest of it, but it also colors the first row even tough im only asking for the last two.

Gediminas12_1-1610415442498.png

 

Gediminas12_0-1610415417671.png

 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

Try to use conditional formatting in table visuals:

First create a measure such as below:

 

Measure = IF(MAX('Table'[Type]) in {"2021 FAKTAS","2021 PLANAS","2020 FAKTAS"},3,
IF(MAX('Table'[Type]) in {"POKYTAS NUO 2021 PLANO"}&&MAX('Table'[value])>0,2,
IF(MAX('Table'[Type]) in  {"POKYTAS NUO 2020 FAKTO"}&&MAX('Table'[value])>0,1,0)))

 

Then create a rule as below:

 
 
 

2.PNG

And you will see:

v-kelly-msft_3-1610609396698.png

Below is a related reference:

https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-conditional-table-formatting

 

For the sample .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

View solution in original post

6 REPLIES 6
amitchandak
Super User
Super User

@Anonymous I doubt RGB in Double quotes. Use color names and check.

You can also use hexcode like #FF0000

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak Thank you so much for your help, but the issue still there. Tried changing to different colors, name it and etc. 

@Anonymous ,Can you share a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
amitchandak
Super User
Super User

@Anonymous . Take max in place of selected value and try. You need force row context.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak Max still colors the first row. 

Hi @Anonymous ,

Try to use conditional formatting in table visuals:

First create a measure such as below:

 

Measure = IF(MAX('Table'[Type]) in {"2021 FAKTAS","2021 PLANAS","2020 FAKTAS"},3,
IF(MAX('Table'[Type]) in {"POKYTAS NUO 2021 PLANO"}&&MAX('Table'[value])>0,2,
IF(MAX('Table'[Type]) in  {"POKYTAS NUO 2020 FAKTO"}&&MAX('Table'[value])>0,1,0)))

 

Then create a rule as below:

 
 
 

2.PNG

And you will see:

v-kelly-msft_3-1610609396698.png

Below is a related reference:

https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-conditional-table-formatting

 

For the sample .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.