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
davisaj2
New Member

Conditional Formatting

Is there a way to change the color of the columns (PD_QTY) based on the date? I'm looking to change the color for values in the future. When I click on the function button for the column color, I only get an option to count the date field, not based upon what the date it.

davisaj2_0-1656611742035.png

 

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

Hi @davisaj2 ,

According to your description, modify your formula to:

Change Qty Color =
VAR PDDate =
    MAX ( 'PD Hist'[DATE] )
RETURN
    IF ( PDDate < TODAY (), "#FF0000", IF ( PDDATE >= TODAY (), "#008000" ) )

In the visualization formatting pane>Columns>Colors, click the fx button.

vkalyjmsft_0-1657099817794.png

Select the measure in the based on field.

vkalyjmsft_2-1657100003496.png

Get the correct result.

vkalyjmsft_3-1657100060571.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

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

4 REPLIES 4
v-yanjiang-msft
Community Support
Community Support

Hi @davisaj2 ,

According to your description, modify your formula to:

Change Qty Color =
VAR PDDate =
    MAX ( 'PD Hist'[DATE] )
RETURN
    IF ( PDDate < TODAY (), "#FF0000", IF ( PDDATE >= TODAY (), "#008000" ) )

In the visualization formatting pane>Columns>Colors, click the fx button.

vkalyjmsft_0-1657099817794.png

Select the measure in the based on field.

vkalyjmsft_2-1657100003496.png

Get the correct result.

vkalyjmsft_3-1657100060571.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

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

This worked! Thank you so much!

otravers
Community Champion
Community Champion

Apply conditional formatting by field value, i.e. use a DAX expression to set conditions and the corresponding colors:

https://powerbidocs.com/2020/11/02/conditional-formatting-by-field-value-in-power-bi/

------------------------------------------------
1. How to get your question answered quickly - good questions get good answers!
2. Learning how to fish > being spoon-fed without active thinking.
3. Please accept as a solution posts that resolve your questions.
------------------------------------------------
BI Blog: Datamarts | RLS/OLS | Dev Tools | Languages | Aggregations | XMLA/APIs | Field Parameters | Custom Visuals

Thank you for the link recommendation. I tried to replication the measure using a date instead of a number and Power BI didn't like the date field. Any suggestions?

 

Change Qty Color =
VAR PDDate = Date( 'PD Hist'[DATE] )
RETURN
IF (
PDDate < TODAY(),
"#FF0000", --Red color
IF (
PDDATE >= TODAY(),
"#008000" --Green Color))))

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

Top Solution Authors