Forum Discussion

IntaBruce's avatar
IntaBruce
Resolver I
2 years ago

Conditional formatting confusion

Hi,

I've used conditional formatting before and got it working fine, but today I am having problems.  In the table below I want the text in the Status column to be green or red for Pass or Fail.

 

I created the following measure:

Status Colour = SWITCH(SELECTEDVALUE(Quality[Status])
                        ,"Pass","Green"
                        ,"Fail","Red"
)
And then I used that measure to conditionally format the Status field based on the Status Colour measure.  As you can see below it worked.

BUT, when I don't include the Status Colour measure as a column in the table the Status column reverts to black

What am I doing wrong?  I obviously don't want to include the colour name in the visual.
Thanks for you help.

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi All,

    Firstly,  shafiz_p and AnkitaaMishra  thank you for yours solution!

    And IntaBruce can you provide the relevant instance data, or your pbix file, as my instance data is too simple and perhaps does not replicate your question.

    Hope it helps!

     

    Best regards,
    Community Support Team_ Tom Shen

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

     

  • Hi IntaBruce  To fix this problem, go to cell elements in the format pane, click font color. See the image below:

     

    Then set the format style "Field Value" and Select your measure in the "What Field Should". See the image below:

     

     

     

    Hope this helps!!

    If this solved your problem, please mark it as a solution!!

    • IntaBruce's avatar
      IntaBruce
      Resolver I

      Thanks shafiz_p I looked there and the same config appears there already, it seems to be two ways to reach the single setting so changing this doesn't work.

       

      • shafiz_p's avatar
        shafiz_p
        Super User

        IntaBruce  Not very much clear. If the provided solution by AnkitaaMishra  or me not worked, there is other way to check if this working or not. Make it hardcoded. Check the given image for another solution. Select series "Status" and Click on fx button under the font color.

         

         

         

        You will get screen like below. Set value same as the given image.

        Hope this helps!!

        If this solved your problem, please mark it as a solution!!

  • Hi IntaBruce , 
    I am using the same DAX as you have used and applying the conditional formatting from using the format visual pane ---> under cell elements section ---> click on 'fx' function for font color as shown below : 

    Please let me know if this works for you or provide additional details for your requirement.

    Thanks,

    Ankita



    • IntaBruce's avatar
      IntaBruce
      Resolver I

      Thanks AnkitaaMishra  I looked there and the same config appears there already, it seems to be two ways to reach the single setting so changing this doesn't work.