Forum Discussion

Shubha_Udyawar's avatar
Shubha_Udyawar
Frequent Visitor
6 years ago
Solved

Conditional formatting for colours in Stacked column chart

Hi,

I want to conditional format a stacked column chart. I mean , the negative values should be turned to red. I am able to do it when i have a single value column but when i add one more column, the conditonal colour formatting option goes away. Can anyone help?

Thank you in advance.

  • Hi Shubha_Udyawar ,

     

    That has to do with the caractheristics of the chart type when adding additional columns the values start to be stacked so the condittional stops working.

     

    If you are only adding 2 columns one work around can be create 4 measures (2 for positive and 2 for negatives)

    SUM NEGATIVE 1 = IF(SUM('Table'[Column1])>0 ;BLANK();SUM('Table'[Column1]))
    SUM POSITVE 1 = IF(SUM('Table'[Column1])<0 ;BLANK();SUM('Table'[Column1]))
    SUM NEGATIVE 2 = IF(SUM('Table'[Column2])>0 ;BLANK();SUM('Table'[Column2]))
    SUM POSITIVE 2 = IF(SUM('Table'[Column2])<0 ;BLANK();SUM('Table'[Column2]))

     

    Now just colour your 2 negative measure as red.

6 Replies

  • Hi Shubha_Udyawar ,

     

    That has to do with the caractheristics of the chart type when adding additional columns the values start to be stacked so the condittional stops working.

     

    If you are only adding 2 columns one work around can be create 4 measures (2 for positive and 2 for negatives)

    SUM NEGATIVE 1 = IF(SUM('Table'[Column1])>0 ;BLANK();SUM('Table'[Column1]))
    SUM POSITVE 1 = IF(SUM('Table'[Column1])<0 ;BLANK();SUM('Table'[Column1]))
    SUM NEGATIVE 2 = IF(SUM('Table'[Column2])>0 ;BLANK();SUM('Table'[Column2]))
    SUM POSITIVE 2 = IF(SUM('Table'[Column2])<0 ;BLANK();SUM('Table'[Column2]))

     

    Now just colour your 2 negative measure as red.

    • Shubha_Udyawar's avatar
      Shubha_Udyawar
      Frequent Visitor

      MFelix ,

      Thank you and my apologies too. I have a correction in my question, what if one of them is a column and the other one is a measure ? Can i still use this as a solution?

      • Shubha_Udyawar's avatar
        Shubha_Udyawar
        Frequent Visitor

        MFelix ,

        Thank you so much, that did work for me.
        Now, the colours are showing as i wanted but there are 4 legends instead of two. So I think ill just go ahead and turn off the legends.

    • Patekos's avatar
      Patekos
      Frequent Visitor

      Olá Miguel Félix,

      É possível usar uma alternativa semelhante com 2 colunas e 4 cores? uma das colunas pode ter 3 cores diferentes.

      Thank You

      • MFelix's avatar
        MFelix
        Icon for Super User rankSuper User

        Boa noite,

         

        Em principio sim a única questão que se coloca é qual o limite para que cada cor fique ativa então em vez de ser o formato anterior teria de ser algo similar:

         

        SUM NEGATIVE 1 = IF(SUM('Table'[Column1])>0 ;BLANK();SUM('Table'[Column1]))
        SUM POSITVE until 1000 = IF(SUM('Table'[Column1])>0 && SUM('Table'[Column1])<= 1000; SUM('Table'[Column1]);BLANK();SUM('Table'[Column1]))
        SUM POSITVE above 1000 = IF(SUM('Table'[Column1])>1000
        ; SUM('Table'[Column1]);BLANK();SUM('Table'[Column1]))