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! Learn more

Reply
Anonymous
Not applicable

How to make bar chart color change to yellow after COVID ?

Hi All

 

I get this expression from be from below post :-

 

Bar Color = IF(MAX('Date'[Date])>=DATE(2019,1,1), "Green", "Yellow")

 

https://community.powerbi.com/t5/Desktop/Monthly-Bar-chart-how-to-set-X-axis-bar-color-before-COVID/...

 

I dont know how to make use of the above expression to make my month bar chart bar color change to yellow after covid 19 pandemic 

 

Paul

 

Paul

 

 

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

a1.png

 

You may create a measure as below.

Visual Control = 
IF(
    MAX('Table'[Date])>=DATE(2019,1,1),"Green","Yellow"
)

 

Then you need to make the visual selected, go to 'Visualizations', click 'Format' and set the 'fx' for 'Default color' in 'Data colors'.

a2.png

a3.png

 

Best Regards

Allan

 

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

View solution in original post

9 REPLIES 9
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

a1.png

 

You may create a measure as below.

Visual Control = 
IF(
    MAX('Table'[Date])>=DATE(2019,1,1),"Green","Yellow"
)

 

Then you need to make the visual selected, go to 'Visualizations', click 'Format' and set the 'fx' for 'Default color' in 'Data colors'.

a2.png

a3.png

 

Best Regards

Allan

 

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

manikumar34
Solution Sage
Solution Sage

@Anonymous , 

Please check the below link. Let me know if anything that you want to know. 

 

https://www.dropbox.com/s/3paix06o82v3fob/preWebinarPostCal_PY_DATA%20V008%20Working.pbix?dl=0

 

Regards, 
Manikumar





If this helps, Appreciate your KUDOS!
Did I answer your question? Mark my post as a solution!


Proud to be a Super User!




Anonymous
Not applicable

Hi Sir

Thank you very much for sharing , it work now , but i still not sure where to set , can you share with the screen shot ?

Paulyeo11_0-1603147380790.png

 

@Anonymous ,

 

Click on the fx button Under data colors

 

manikumar34_0-1603170839445.png

 

Then select Format By as Field Value and then choose the measure for the color.

 

manikumar34_1-1603170898744.png

 

Regards, 

Manikumar

 

If you find this is helpful, Accept as a Solution and leave a like.

 

 





If this helps, Appreciate your KUDOS!
Did I answer your question? Mark my post as a solution!


Proud to be a Super User!




Anonymous
Not applicable

Hi Sir

 

Thank you very much for sharing the 2 screen shot , very sorry i still cannot locate where to paste the script to Affordability. Below is the screen shot from the doc.

Paulyeo11_0-1603171837619.png

 

@Anonymous , 

 

You have to create a measure and use that for the coloring. 

 

Regards, 

Manikumar





If this helps, Appreciate your KUDOS!
Did I answer your question? Mark my post as a solution!


Proud to be a Super User!




Anonymous
Not applicable

Hi Sir

Very sorry for the below chart you have create for me , may i know where you put the expression for make the 2 bar color turn to yellow ? i still cannot locate it.

Paulyeo11_0-1603180681031.png

 

@Anonymous , 

 

Under the data colors, you can see an option like fx, click on fx and choose format by as field value and select the field with the measure you created. 

 

Rgeards, 

Manikumar

 





If this helps, Appreciate your KUDOS!
Did I answer your question? Mark my post as a solution!


Proud to be a Super User!




amitchandak
Super User
Super User

@Anonymous , Under data value, You will get an fx icon near to color.

Click on that and then pop up will open in that choose "field value" and this meausre.

 

This will only work in bar when you have only one measure and no legend

 

Refer

https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-numbers-in-the-column
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

 

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
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