Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Ayappan
Helper III
Helper III

Highlight the max value in count column power bi dax

Hi Team ,

      i want to highlight the max vlaue in Table visual.I have data as below . 

      I dont have seperate column for Count of injection Category . I used Count of in Table visual.

      I want to find the max value in count of inject category and add  a new column with color and i should use it in conditional formatting.

  Help me to get the max value in red color and others in green in next new column

 

Ayappan_0-1690895483480.png

 

1 ACCEPTED SOLUTION

hello @Ayappan 

annonymous1999_5-1690961356920.png

 



step 1 

create count measure

Count = COUNTROWS('Table')


step 2 create the max measure


max of = MAXX(ALLSELECTED('Table'[Catgeory]),[Count])


step 3 create the hightlight measure

Highlight = 
VAR cond = 
IF([Count] = [max of],1,0)
RETURN
IF(cond = 1 , "Red","Green")


step 4 press on your table and go to cell elemnt in the format panel

annonymous1999_1-1690961232286.png

 


step 5 select the column you want to highlight 

step 6 choose background color

annonymous1999_2-1690961271480.png


step 7 press fx and select field value

annonymous1999_3-1690961292773.png

 

step 8 

use the highlight measure and click done
results

annonymous1999_4-1690961321971.png

please leave a thumbs up and accept as solution if i helped you answer your question

 

View solution in original post

8 REPLIES 8
eliasayyy
Super User
Super User

hello i did a simple dataset

annonymous1999_0-1690897972294.png


i created a measure Total which is = CALCULATE(SUM('Table'[Total]))

now i added them to a table

next you need to create a measur ethat will identify what is your max and minimum

Max Value = 
VAR _m = MAXX(ALLSELECTED('Table'),[Total Is])
VAR _con = IF(_m=[Total Is],1,0)
RETURN
IF(_con = 1 , "Red","Green")


next, press on your table to format it ,

go to cell ement part of the format and toggle on background color

choose field value and select your measure

annonymous1999_1-1690898117211.png

 

annonymous1999_2-1690898129124.png

 

 


end result

annonymous1999_3-1690898210072.png

 


if i helped you solve your question , please consider liking and accepting as solution to better help others

Hi @eliasayyy 

     Thanks for you replay . I Dont have Total column in my Database . 
I have only 1 Column and i am using the count of the 1st colimn in Table visual .

Example : in you case i have only Month Column . In my database multiple records has jan feb ... so i am using the count of as 2nd column . I am not able to use the count in the formula you gave .

Let me know how to use it .

Aagin Thanks 

Can you share please sample data as well as your measure 

@eliasayyy   

Sample Record from Table

Requirements A
OthersB
Design/CodeC
Training A
OthersB
Requirements C
OthersA
Requirements B
OthersC
Design/CodeA
Design/CodeB
Design/CodeC
Design/CodeA
Design/CodeB
Design/CodeC
Requirements A
Requirements B
Requirements C
Training A
OthersB

 

In Power Bi I had used 

Column 1 and Count of Column 1

Ayappan_0-1690959007158.png

Ayappan_1-1690959104482.png

 

I did't use any measure

 

Thanks

hello @Ayappan 

annonymous1999_5-1690961356920.png

 



step 1 

create count measure

Count = COUNTROWS('Table')


step 2 create the max measure


max of = MAXX(ALLSELECTED('Table'[Catgeory]),[Count])


step 3 create the hightlight measure

Highlight = 
VAR cond = 
IF([Count] = [max of],1,0)
RETURN
IF(cond = 1 , "Red","Green")


step 4 press on your table and go to cell elemnt in the format panel

annonymous1999_1-1690961232286.png

 


step 5 select the column you want to highlight 

step 6 choose background color

annonymous1999_2-1690961271480.png


step 7 press fx and select field value

annonymous1999_3-1690961292773.png

 

step 8 

use the highlight measure and click done
results

annonymous1999_4-1690961321971.png

please leave a thumbs up and accept as solution if i helped you answer your question

 

@eliasayyy Thanks a lot .It helped me is this same applies for Matrix Table also ?

Yes the same applies to matrix tables

Hi @eliasayyy 

  In matrix i am facing some problem .Same measures i had used. Its not wokring as expected .

1st measure 

M_CountofMetrics = COUNTROWS(metrics)
2nd measure 
M_MAX_TNK_Issue_Detection = MAXX(ALLSELECTED(jirametrics[Area of Issue detection]),[M_CountofMetrics])
 
3rd measure
M_Highlight__MAX_TNK_Issue =
VAR cond =
IF([M_CountofMetrics] = [M_MAX_TNK_Issue_Detection],1,0)
RETURN
IF(cond = 1 , "LightGray","White")
 

Ayappan_0-1690987872877.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.