Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Conditional color formatting on Matrix based on dimension values

 

Hello,

matrix, @conditionalformatting

I am trying conditional coloring on a matrix i am working on.

 

I need conditional formatting based on the screenshot i have above.

 

In Rows section each Service has Task 1, Task 2, Task 3 under it.

In Columns there are Accounts and under each Service for the Task there is specific number of Accounts under it.

 

The color coding should follow the Legend format shown on the right.

 

Any quick help is much appreciated.

 

Thank you.

  • Hi Anonymous ,

     

    You could create a measure to set it in the conditional formatting. You could replace the color codes with yours.

     

    Measure color = 
    var a = sum(test[Value])
    return
    SWITCH(TRUE(),
      a=0||ISBLANK(a),"#BDBDBD",
      a>=1&&a<=3&&SELECTEDVALUE(test[Task])="T1","#F3CB46",
      a>=4&&a<=6&&SELECTEDVALUE(test[Task])="T1","#D5B448",
      a>=7&&SELECTEDVALUE(test[Task])="T1","#8B752A",
      a>=1&&a<=3&&SELECTEDVALUE(test[Task])="T2","#519EFB",
      a>=4&&a<=6&&SELECTEDVALUE(test[Task])="T2","#3B8AEA",
      a>=7&&SELECTEDVALUE(test[Task])="T2","#0350AE",
      a>=1&&a<=3&&SELECTEDVALUE(test[Task])="T3","#74E74E",
      a>=4&&a<=6&&SELECTEDVALUE(test[Task])="T3","#5FB841",
      a>=7&&SELECTEDVALUE(test[Task])="T3","#2C7F10",
    "#BDBDBD"
    )

     

    Here is my result.

    Here is my test file for your reference.

     

2 Replies

  • v-eachen-msft's avatar
    v-eachen-msft
    Community Support

    Hi Anonymous ,

     

    You could create a measure to set it in the conditional formatting. You could replace the color codes with yours.

     

    Measure color = 
    var a = sum(test[Value])
    return
    SWITCH(TRUE(),
      a=0||ISBLANK(a),"#BDBDBD",
      a>=1&&a<=3&&SELECTEDVALUE(test[Task])="T1","#F3CB46",
      a>=4&&a<=6&&SELECTEDVALUE(test[Task])="T1","#D5B448",
      a>=7&&SELECTEDVALUE(test[Task])="T1","#8B752A",
      a>=1&&a<=3&&SELECTEDVALUE(test[Task])="T2","#519EFB",
      a>=4&&a<=6&&SELECTEDVALUE(test[Task])="T2","#3B8AEA",
      a>=7&&SELECTEDVALUE(test[Task])="T2","#0350AE",
      a>=1&&a<=3&&SELECTEDVALUE(test[Task])="T3","#74E74E",
      a>=4&&a<=6&&SELECTEDVALUE(test[Task])="T3","#5FB841",
      a>=7&&SELECTEDVALUE(test[Task])="T3","#2C7F10",
    "#BDBDBD"
    )

     

    Here is my result.

    Here is my test file for your reference.

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you so much v-eachen-msft .

      The solution worked perfectly.

      😊👍.