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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
preacher_baby
Frequent Visitor

DAX measure for the column/pie/ charts to color only the max value bar/slice

Basically title. Say I have a bar / column chart with the maximum count of category having 5, while others have lower. I want this particular bar to be color with specific color, while other bars should have the same color.

2 REPLIES 2
Anonymous
Not applicable

Hi @preacher_baby ,

 

Has your problem been solved? If the problem has been solved you can mark the reply for the standard answer to help the other members find it more quickly. If not, please point it out. Thanks in advance.

 

Best Regards,

Neeko Tang

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

ChiragGarg2512
Solution Sage
Solution Sage

@preacher_baby , need to create a DAX measure using switch statement. In switch statement first parameter is values(column with category name), and the expression will be a dax that gives the name of category with highest count, value if this condition is true is the color wanted for top category and next is the color wated for remaining categories.

The expression will be made using index function.

Color top 1 = SWITCH(values('TableName'[category]),
maxx(INDEX(1,ALLSELECTED('TableName'[category]),ORDERBY([category count],DESC)), [category]), "Green",
"blue")

Change color as per convenience. Category count is a measure that with dax count('TableName'[category]).
If the category column is sorted by any numerical value include that column in ALLSELECTED.
 
Thank You.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.