Forum Discussion

ngct1112's avatar
ngct1112
Icon for Post Patron rankPost Patron
5 years ago

MAX value of columns(Conditional Formatting)

Hi all,

 

I am trying find the MAX value of each row from 3 measures(A,B,C) and highlighted them in GREEN.

May I know could I use ONE measure to handle this?

IDABC
112522
25649625
3322136
4658421

 

Color =

VAR _Darkgreen = " #34A853"

var _A = DISTINCTCOUNT('TableA'[ID])

var _B = DISTINCTCOUNT('TableB'[ID])

var _C = DISTINCTCOUNT('TableC'[ID])

var _list= FILTER({var _A, var _B, var _C},[Value]<>BLANK())

var _max = MAXX(_list,VALUE([Value]))

Return IF(Table[A] = _max, _Darkgreen)

 

However, for my code, it can only apply to Column A, is it possible I could have a measure which could apply to 3 columns?

 

Thanks if any help!





 

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    ngct1112 

    Not very clear to me, you have 3 measures(ABC) but you want it apply to  3 column (ABC)? Are they actually columns or measures? And is the above sample a data table or just a table visual in the report? And according to the dax, seems there are 3 tables TableABC in your model?

     

    In case you have a few tables, please repost and share a sample pbix that can actually describe your model. Dax is based on the data table, share a visual does not help much in understanding the situation.

     

     

    Paul Zheng _ Community Support Team

     

     

  • jmdublu's avatar
    jmdublu
    Frequent Visitor

    I think the gist of the request is to have this apply dynamically and broadly, based on whatever column this measure is placed "under."  I.e., someting more like:

    FormatAll =

     

    var _Darkgreen = " #34A853"

    var _A = DISTINCTCOUNT('TableA'[ID])

    var _B = DISTINCTCOUNT('TableB'[ID])

    var _C = DISTINCTCOUNT('TableC'[ID])

    var _list= FILTER({var _A, var _B, var _C},[Value]<>BLANK())

    var _max = MAXX(_list,VALUE([Value]))

     

    // pseudo-code example:
    var _column = getColumnName(Table)

     

    Return IF(Table[_column] = _max, _Darkgreen)