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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
v-shex-msft
Community Support
Community Support

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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