Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Conditional formatting by matrix segment

Hi, I have a matrix table that has a segment with each employee under that segment. I need each segment to identify the max value ( the person with the highest number) with conditional formatting to highlight the value. 

 

I have tried everything but keep only coloring the highest value overall in the column, not by segment. Below are the two dax, I have had tried

 

Dax 1

Rank = VAR HighestValue = MAXX(ALLSELECTED('table'[Segment], 'table'handlername), [Promoter Count])

RETURN

IF ([Promoter Count]= HighestValue, "Red")

 

Dax 2

Rank = VAR HighestValue = MAXX(ALL(table'segment, 'table'hnadler name), [Promoter Count])

 

RETURN

SWITCH( 

   TRUE(),

   MAX('20220421072842-SurveyExport'[Segment]) = "AMD" && [Promoter Count] = HighestValue, "blue",

   MAX('20220421072842-SurveyExport'[Segment]) = "Property" && [Promoter Count] = HighestValue, "Yellow",

   MAX('20220421072842-SurveyExport'[Segment]) = "Liability" && [Promoter Count] = HighestValue, "Red",

   MAX('20220421072842-SurveyExport'[Segment]) = "WC" && [Promoter Count] = HighestValue, "orange")

 

 

 

 

 

 

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    I have created a simple sample, please refer to it to see if it helps you.

    Create two measures.

    Measure =
    VAR _maxvalue =
        MAXX (
            FILTER (
                ALL ( 'table' ),
                'table'[Segment] = SELECTEDVALUE ( 'table'[Segment] )
            ),
            [Promoter CountME]
        )
    RETURN
        IF ( 'table'[Promoter CountME] = _maxvalue, "Red", BLANK () )
    
    Rank_a =
    VAR HighestValue =
        MAXX (
            FILTER (
                ALL ( 'table' ),
                'table'[Segment] = SELECTEDVALUE ( 'table'[Segment] )
            ),
            [Promoter CountME]
        )
    RETURN
        SWITCH (
            TRUE (),
            MAX ( 'table'[Segment] ) = "AMD"
                && [Promoter CountME] = HighestValue, "blue",
            MAX ( 'table'[Segment] ) = "Property"
                && [Promoter CountME] = HighestValue, "Yellow",
            MAX ( 'table'[Segment] ) = "Liability"
                && [Promoter CountME] = HighestValue, "Red",
            MAX ( 'table'[Segment] ) = "WC"
                && [Promoter CountME] = HighestValue, "orange"
        )
    

    How to Get Your Question Answered Quickly 

     

    If I have misunderstood your meaning, please provide more details with your desired output and pbix file without privacy information.

     

     Best Regards
    Community Support Team _ Polly

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

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi! This is close to what I need. For some reason, instead of pointing out the highest value is pointing the lowest when I used the recommended dax. Any idea of why?

       

      Probably because my table under each segment has the employee? 

       

       

       

       

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Anonymous ,

        Please check the  measure [Promoter Count].  How did you write your formula?  Please return the HighestValue. Check if this formula returns the maximum value.

         

        Rank_a = VAR HighestValue = MAXX(filter(ALL('table'), 'table'[Segment]=SELECTEDVALUE('table'[Segment])), [Promoter CountME])
        
         
        
        RETURN HighestValue
        
        //SWITCH( TRUE(), MAX('table'[Segment]) = "AMD" && [Promoter CountME] = HighestValue, "blue",MAX('table'[Segment]) = "Property" &&[Promoter CountME] = HighestValue, "Yellow",MAX('table'[Segment]) = "Liability" && [Promoter CountME] = HighestValue, "Red", MAX('table'[Segment]) = "WC" && [Promoter CountME] = HighestValue, "orange")

         

         

          

        Please provide more screenshots with measure [Promoter Count] and the return value.

         

        Best Regards
        Community Support Team _ Polly

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