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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
em12963
Helper I
Helper I

Highlighting a highest and lowest colour on bar graph using DAX and conditional formatting

Hi there

 

I am trying to highlight a highest(green) and lowest(red) colour on my stacked column chart visual. 

My ideal visual should like the image attached whereby D is the group with the largest quantity and so is green in colour, and B is red as it's the lowest quantity, the rest are blue.graph.png

 

I have created a new measure:

Highest / Lowest value =
var highestvalue = MAXX(ALLSELECTED('Table'[Group]),CALCULATE(SUM('Table'[Quantity])))
var lowestvalue = MINX(ALLSELECTED('Table'[Group]),CALCULATE(SUM('Table'[Quantity])))
return
SWITCH(CALCULATE(SUM('Table'[Quantity])),
highestvalue , "#73B761",
lowestvalue , "#D64550",
"#879092" )
 
I added that measure in the conditional settings in the Format settings chart -> Columns -> Colors fx part.
 
However, my dax doesn't seem to be working. It's making every column group green. 
Help. 
1 ACCEPTED SOLUTION

Hi , I realised that the code actually worked. What was stopping it from working was that I had previously had the 'Group' column sorted by another column in the data section. After removing that, then my colours appeared in the visual. 

 

Attached is the report

https://1drv.ms/u/s!AldfJ8BDTJeOnXwCB34BxFF3cTIA?e=HnpVTT

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @em12963,

Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

Hi , I realised that the code actually worked. What was stopping it from working was that I had previously had the 'Group' column sorted by another column in the data section. After removing that, then my colours appeared in the visual. 

 

Attached is the report

https://1drv.ms/u/s!AldfJ8BDTJeOnXwCB34BxFF3cTIA?e=HnpVTT

Anonymous
Not applicable

HI @em12963,

I'm glad to hear you find the reason and share the solution here, they will be help others who faced the similar issues.

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors