Forum Discussion

CreateU's avatar
CreateU
New Member
4 years ago

Matrix gradient independant to column counts

Hiya,

 

I've got a matrix table with two columns with counts of number of users in a department between two groups. I'm trying to format the background gradient to be independant to the group instead of to the total count across the two columns. Any thoughts if this is possible?

 

For example, in the first totals column 46 should be the darkest as it's the largest number for that column, and 21 in column 1 & 461 in column 2would be the same color since they're both the lowest value.

 

 

3 Replies

  • CreateU , if they are two measures you can choose a separate column/measure for conditional formatting. But if they are using same measure pivoted by matrix column, I think difficult to achieve 

    • CreateU's avatar
      CreateU
      New Member

      Yeah it's the same measure. I've duplicated the graphs and minimized the columns I don't want. but I feel like there should be a nicer way of doing this.

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

    Hi CreateU ,

     

    As amitchandak said, you cannot implement a legend-based gradient color for one measure/column.

     

    If you only care about the max and min colors, try using the following measure to format the background color.

     

    color = 
    VAR maxValue =
        MAXX ( ALLSELECTED ( 'Table'[ID] ), [Measure] )
    VAR minValue =
        MINX ( ALLSELECTED ( 'Table'[ID] ), [Measure] )
    RETURN
        SWITCH ( [Measure], maxValue, "#118DFF", minValue, "#a0d1ff", "#70bbff" )

     

    Otherwise, you will have to use two measures to achieve it.

     

    Measure_X = CALCULATE ( [Measure], 'Table'[Type] = "X" )
    Measure_Y = CALCULATE ( [Measure], 'Table'[Type] = "Y" )

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
    Best Regards,
    Winniz
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.