Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Coloring Values Assistance

Hello community! I have created a matrix and a table on the same tab of a Power BI Report. (See 1st picture below) The table on the left uses conditional columns which I manually inserted int...
  • DataInsights's avatar
    4 years ago

    Anonymous,

     

    You can achieve this with a measure that determines the color:

     

    Color Measure = 
    VAR vCount = [Count StudentID]
    VAR v15Staff =
        MAX ( Table1[15 Staff] )
    VAR v5Staff =
        MAX ( Table1[5 Staff] )
    VAR vResult =
        // use color names or hex codes
        SWITCH ( TRUE, vCount > v5Staff, "Green", vCount < v15Staff, "#E6113C", "Yellow" ) 
    RETURN
        vResult

     

    Create conditional formatting for the measure [Count StudentID]:

     

     

  • v-zhangti's avatar
    4 years ago

    Hi, Anonymous 

     

    Based on the data you have provided, you can refer to the following methods.

    Measure = 
    Var N1=DISTINCTCOUNT('Table'[StudentID])
    return
    SWITCH(TRUE(),
    N1>SELECTEDVALUE('Table'[5 Staff]),"Green",
    N1<SELECTEDVALUE('Table'[15 Staff]),"Red",
    "Yellow")

    Is this the result you expect?

     

    Best Regards,

    Community Support Team _Charlotte

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