Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Persistent color and table conditional coloring

Hello,

I have a couple things I can't figure out regarding conditional formating and colors

 

-Is there a way to bind a color to a field value? I have a True/false field in my report that I use a lot; I would like to always have Green/red colors when I use this field as a legend when I create a new chart. That seems like a basic functionality for report consistency but I can't find it.  

 

-In Table conditional formating, how can I format based on the same value ? I want to have a green/red cell based on the value of the same boolean but it seems it only work with aggregation or color code. Do i need to have a 1/0 field or a color code field in addition to my boolean to achieve this ?

 

Thanks for your support

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous ,

    From my test, conditional formatting could be applied for Data color ,but it seems not reach the same output as in table.

    I suggest you use custom theme instead like this:

    Please take a look at the different output shown below:

     

    Here is the pbix file.

     

    But this is at idea/feedback level alone. Please let the power bi community to know this things and give your votes at power bi site's feedback - https://ideas.powerbi.com/ideas/idea/?ideaid=31fd95a4-308f-4a28-a3d4-10489b973642

     

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

     

    Best Regards,

    Eyelyn Qin

4 Replies

  • Hi Anonymous ,

     

    To do this you can create a measure that will do the condittional formatting on all your visualizations. You need to do something similar to:

     

    Condittional Formatting =
    SWITCH(SELECTEDVALUE(Table[Column]);
    True(); "Green";
    False(); "Red"
    
    )

    The just use this measure on all the formatting fields you needs.

     

    Two remarks about the measure above:

    • I have use SELECTEDVALUE but for example only this can be used with a measure value with a MAX, MIN, and so on, the trick is to pickup the value you need and on the rest of the parameters set the different options and corresponding colours
    • The "Green" and "Red" part can be changed to HEX codes that have the following pattern "#000000"
    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Miguel,

      Thanks for the tip, having this in a measure works works well for formating my table. 

       

      However in other charts (ex: stacked bar charts or donut), I don't see any way to use this, I have no formula option in the "Data color" pane when I have a field used as a legend.  So I see no way of permanently bind a field value to a color. As a previous Tableau and Qlik user, that seems like a serious shortcoming for PowerBI .

      • MFelix's avatar
        MFelix
        Super User

        When you use the legend on a visualization some of the features aren't available that is the case of the condittioonal formatting you need to use measures or columns on your visualization. 

         

        I don't know the exact setup of your model but if you create a measure for true and false you are able to then make the condittioonal formatting 

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    From my test, conditional formatting could be applied for Data color ,but it seems not reach the same output as in table.

    I suggest you use custom theme instead like this:

    Please take a look at the different output shown below:

     

    Here is the pbix file.

     

    But this is at idea/feedback level alone. Please let the power bi community to know this things and give your votes at power bi site's feedback - https://ideas.powerbi.com/ideas/idea/?ideaid=31fd95a4-308f-4a28-a3d4-10489b973642

     

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

     

    Best Regards,

    Eyelyn Qin