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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
MarkD1722
Frequent Visitor

Conditional Formatting not working as expected

I have the following conditional formatting setup.  I am basically trying to camouflage any result of zero with the background color.   Any blanks should become zeros based on my measure.  I thought I had this working properly at one point, but now I appears that my zeros don't change colors.  My measure is:

HUB - Status Count =

VAR CountStatuses = COUNTX(FILTER('FULL PROJECT LIST', NOT(ISBLANK('Z - Loc Summary Measures List'[LS Project Activity]))), 'FULL PROJECT LIST'[Project #])
RETURN

IF(ISBLANK(CountStatuses), 0, CountStatuses)

 


MarkD1722_0-1714998725843.png



Thanks.


Mark

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

Hi @MarkD1722 ,

I create a table as you mentioned.

vyilongmsft_0-1715145581109.png

Then I create a measure and here is the DAX code.

Measure = 
CALCULATE (
    COUNTX ( FILTER ( 'Table', 'Table'[Column] = "Y" ), 'Table'[Column] )
)

When I add Conditional formatting and I think you can let value to be blank.

vyilongmsft_1-1715145894835.png

So when it is blank, it will be the right color.

vyilongmsft_2-1715146003861.png

 

 

 

Best Regards

Yilong Zhou

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

3 REPLIES 3
v-yilong-msft
Community Support
Community Support

Hi @MarkD1722 ,

I create a table as you mentioned.

vyilongmsft_0-1715145581109.png

Then I create a measure and here is the DAX code.

Measure = 
CALCULATE (
    COUNTX ( FILTER ( 'Table', 'Table'[Column] = "Y" ), 'Table'[Column] )
)

When I add Conditional formatting and I think you can let value to be blank.

vyilongmsft_1-1715145894835.png

So when it is blank, it will be the right color.

vyilongmsft_2-1715146003861.png

 

 

 

Best Regards

Yilong Zhou

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

Thank you for your contribution.  So, strangely, I simply removed and reapplied the conditional formatting, making it simply "if value = 0" then change the color and removing any "if blank" conditions I had (which should have been inconsequential).  On some others I had to add another condition to make the color white if it is other than zero because of dark backgrounds which provide little contrast (i.e., because the default font color is black) .  So, I don't believe anything I did was really different, but it did produce a different result, so I am moving forward and not thinking too hard about it.  Thanks again.

 

johnbasha33
Solution Sage
Solution Sage

@MarkD1722 

It seems like you're encountering an issue with conditional formatting not properly applying the background color to cells with zero values in your report. This might be due to the way the conditional formatting rule is configured.

Here are some steps you can take to troubleshoot and potentially resolve the issue:

1. **Check Conditional Formatting Rule**: Ensure that the conditional formatting rule you've set up is correctly configured to apply the background color when the value is zero. Double-check the conditions and formatting options to make sure they match your requirements.

2. **Evaluate Measure Output**: Verify that your measure, "HUB - Status Count," is indeed returning zero values for cells where the count is zero or blank. You can do this by adding the measure to a table or matrix visual and examining the results.

3. **Test Formatting with Static Values**: As a troubleshooting step, try applying the conditional formatting rule to a static column or measure that you know should contain zero values. This will help determine if the issue lies with the conditional formatting rule or the measure output.

4. **Adjust Formatting Options**: In Power BI, conditional formatting allows you to customize various formatting options, including background color, font color, and font style. Double-check the formatting options you've selected to ensure they are set up correctly for applying the background color.

5. **Refresh Visual**: After making any changes to the conditional formatting rule or measure, refresh the visual containing the data to see if the formatting updates accordingly. Sometimes, the visual may need to be refreshed for the changes to take effect.

By following these steps and ensuring that both the measure output and conditional formatting rule are configured correctly, you should be able to resolve the issue with applying background color to cells with zero values in your Power BI report. If you continue to experience problems, feel free to provide additional details, and I'd be happy to assist further!


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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.