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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

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 and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.