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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Conditional formatting on columns from different tables

Hi All

 

I have two tables with A and B which was created from sqlsever.  Table A has Actual Sales and Table B has Target Sales. Both Tables are related based on a Column WeekNumber . I want to perform conditional formatting on Actuals sales column (TableA) by highlighting the Actual Sales in Green Color if the Target Sales (TableB) is achieved for the corresponding week and city, and if not, then Red color.

What conditional formatting rule I have to apply ?

Capture.PNG

Thanks!

1 ACCEPTED SOLUTION
v-robertq-msft
Community Support
Community Support

Hi, @Anonymous 

According to your description, you want to set the conditional formatting of [Actual sales] according to the comparison of data, you can try my steps:

  1. Create a measure [Color]:
Color =

var _target=

CALCULATE(MAX('Table B'[Target sales]),FILTER('Table B',[City]=MAX('Table A'[City])&&[Week]=MAX('Table A'[Week])))

return

IF(MAX('Table A'[Actual sales])>=_target,"Green","Red")
  1. Click on the table chart of ‘Table A’, “Conditional formatting”->advanced control, then set like this:

v-robertq-msft_0-1607569850113.png

 

  1. Change the font color of [Actual sales] to white, and you can get what you want, like this:

v-robertq-msft_1-1607569850124.png

 

You can download my test pbix file here

 

Best Regards,

Community Support Team _Robert Qin

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

1 REPLY 1
v-robertq-msft
Community Support
Community Support

Hi, @Anonymous 

According to your description, you want to set the conditional formatting of [Actual sales] according to the comparison of data, you can try my steps:

  1. Create a measure [Color]:
Color =

var _target=

CALCULATE(MAX('Table B'[Target sales]),FILTER('Table B',[City]=MAX('Table A'[City])&&[Week]=MAX('Table A'[Week])))

return

IF(MAX('Table A'[Actual sales])>=_target,"Green","Red")
  1. Click on the table chart of ‘Table A’, “Conditional formatting”->advanced control, then set like this:

v-robertq-msft_0-1607569850113.png

 

  1. Change the font color of [Actual sales] to white, and you can get what you want, like this:

v-robertq-msft_1-1607569850124.png

 

You can download my test pbix file here

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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