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
laser_beam
Regular Visitor

Need Help with Creating Conditional Formatting for Max Values across Multiple Years using color red

Hello,

 

I have 2 seperate bar charts with "Months", "Years" (2018-2021), and "Passengers Total". Similarly, the second bar chart has "Months", "Years" (2018-2021), and "Flights Total". I am trying to highlight the busiest months for each year (2018-2021) for "Passengers Total" and Flights Total" using a specific color (red). I have tried changing the colors by using every option available (Gradient, Rules, Field Value) and none of them work or even apply to my particulat data because each year has a different Max value so I can't say if Passengers Totals is <= to 75K then make the color red because it would apply it to all the years and some years the max value is 72K, some 66K, etc. Also, it won't even let me select the word "Max" it wants me to enter a numerical value. I've tried to create a seperate table laying out the Max months and their values per each year and plotting it that way but that doesn't work properly. Below is my current bar charts for both "Passengers Totals" and Flights Totals" and the new tables for each with the max month values per year. 

laser_beam_1-1641426156120.png

 

laser_beam_0-1641426087830.png

laser_beam_3-1641426554429.png

 

laser_beam_2-1641426467843.png

 

 




1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@laser_beam , First of all you can not apply conditional formatting when you use measure. So what you need to do is take both Year and month on axis. then You need expand them as use concatenate label off and sort on axis(year - month), repeat steps if you do not get below

 

Concat Label Off.png

 

 

Post that create a measure . Assuming flight is the measure and you are using

 

Then create a color measure 

Color  =

var _max = calculate(maxx(Values('Date'[Month Year]), [flight ]), filter(allselected('Date') , 'Date'[Year] =max('Date'[Year]) ))

return

Switch(True() ,

[flght] =_max , "Red",

"Green"

)

 

Use in conditional formatting using field value option

How to do conditional formatting by measure and apply it on pie?: https://youtu.be/RqBb5eBf_I4

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@laser_beam , First of all you can not apply conditional formatting when you use measure. So what you need to do is take both Year and month on axis. then You need expand them as use concatenate label off and sort on axis(year - month), repeat steps if you do not get below

 

Concat Label Off.png

 

 

Post that create a measure . Assuming flight is the measure and you are using

 

Then create a color measure 

Color  =

var _max = calculate(maxx(Values('Date'[Month Year]), [flight ]), filter(allselected('Date') , 'Date'[Year] =max('Date'[Year]) ))

return

Switch(True() ,

[flght] =_max , "Red",

"Green"

)

 

Use in conditional formatting using field value option

How to do conditional formatting by measure and apply it on pie?: https://youtu.be/RqBb5eBf_I4

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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!

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
Top Kudoed Authors