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
Anonymous
Not applicable

Matrix conditional format Background color each cell

Hi All,

I am currently looking to conditional format background color of each cell depending on column category & row value using conditions. Is there a way to do it? Please let me know.

 

Thanks

Susheel

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

Hi Susheel,
According to your description, it seems that you want to custom cell background color based on some rules, right?
You could try to follow the steps:
1. Create a new measure.
2. Click the visualization ,then go to Fields in Visualizations pane.
3. Right-click or select the down-arrow next to the field in the Values.
4. Select Conditional formatting ,then Background color.
5. In the pop-up window, Select Field value in Format by field and select the created measure in step1 for Based on field.
For example, the following formula applies different color values to Units Sold column, based on the value of Discount Band and Units Sold columns.

 

 

Discount Band color =
SWITCH (
    TRUE (),
    SUM ( financials[Units Sold] ) < 50000
        && SELECTEDVALUE ( financials[Discount Band] ) = "High", "Yellow",
    SUM ( financials[Units Sold] ) > 50000
        && SELECTEDVALUE ( financials[Discount Band] ) = "Low", "Red"
)

 

 
My example table with Units Sold background color based on calculated looks like this:
case pic.png
Is this result what you want? If you have any questions, please upload some data samples and expected output.
Please do mask sensitive data before uploading.
 
Best Regards,
Eyelyn Qin

 

View solution in original post

2 REPLIES 2
v-eqin-msft
Community Support
Community Support

Hi Susheel,
According to your description, it seems that you want to custom cell background color based on some rules, right?
You could try to follow the steps:
1. Create a new measure.
2. Click the visualization ,then go to Fields in Visualizations pane.
3. Right-click or select the down-arrow next to the field in the Values.
4. Select Conditional formatting ,then Background color.
5. In the pop-up window, Select Field value in Format by field and select the created measure in step1 for Based on field.
For example, the following formula applies different color values to Units Sold column, based on the value of Discount Band and Units Sold columns.

 

 

Discount Band color =
SWITCH (
    TRUE (),
    SUM ( financials[Units Sold] ) < 50000
        && SELECTEDVALUE ( financials[Discount Band] ) = "High", "Yellow",
    SUM ( financials[Units Sold] ) > 50000
        && SELECTEDVALUE ( financials[Discount Band] ) = "Low", "Red"
)

 

 
My example table with Units Sold background color based on calculated looks like this:
case pic.png
Is this result what you want? If you have any questions, please upload some data samples and expected output.
Please do mask sensitive data before uploading.
 
Best Regards,
Eyelyn Qin

 

harshnathani
Community Champion
Community Champion

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.