Forum Discussion

Rostanga's avatar
Rostanga
Frequent Visitor
2 years ago

Color formatting a cell with zero value in a decomposition tree visual

I have a decomposition tree set up and have conditional formatting on the values so they turn either red or green if one of the columns is yes or no.

 

Then i have a count of people in another column.  The problem that I have is that in the cells that are zero, it stays grey.  I want it to go red.   Is there a way around it.

  • I've tried to add in an IF statement before my SWITCH statement to try and make it red, but still won't change.

 

Here is my conditional format code I used in the measure. 

 

Colour Code Measure = IF (
ISBLANK('datasource'[Measure]),"Red",
(SWITCH(
TRUE(),
SELECTEDVALUE('datasource'[Yes/No]) = "Yes", "Green",
SELECTEDVALUE('datasource'[Yes/No]) <> "Yes", "Red"
))
)

 

7 Replies

    • Rostanga's avatar
      Rostanga
      Frequent Visitor

      parry2k  the data source has zero's in it.

      If i put those as null in power query then they disappear completely from the visual. 

      But i need them to show as zero, but then as those would be non-compliant (or they are a no), I need those to also show as red.  I only want the ones that are yes to be green.   

      I haven't added any other parts to the measure to force it. 

  • Rostanga try this:

     

    Colour Code Measure =
    IF (
        [Measure] = 0,
        "Red",
        (
            SWITCH (
                TRUE (),
                SELECTEDVALUE ( 'datasource'[Yes/No] ) = "Yes", "Green",
                SELECTEDVALUE ( 'datasource'[Yes/No] ) <> "Yes", "Red"
            )
        )
    )
    
    • Rostanga's avatar
      Rostanga
      Frequent Visitor

      This is the set I created for this sample decomp tree.  Just kept it small.

       

      The yes/no column is only used in the measure that was created for the colour coding of the data boxes in the tree

  • Rostanga's avatar
    Rostanga
    Frequent Visitor

    I did a bandaid fix for this.  I changed the base colour to the same red, since all of the ones with no values would be a no anyways.