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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
RDF25087
Helper I
Helper I

Date Conditional Formatting

Hello!

 

I have a data table with UK post code areas and a date of the last sale in that area, for example:

 

Post Code AreaLast Sale
AB[NULL]
AL04/04/2023
B23/02/2023
BA[NULL]
BB11/11/2022
BD27/03/2023
BH01/02/2023
BL28/01/2023
BN[NULL]
BR

01/04/2023

 

What I'd like to do is plot these post codes on a map but colour code them.

 

So, on the basis today is 05/04/2023 I'd like to colour code the plots as such:

 

1. If Last Sale is Null/Blank then BLUE

2. If Last Sale is less than a month ago then GREEN

3. If Last Sale is between a month and three months ago then YELLOW

4. If Last Sale is greater than three months ago then RED

 

Is this possible? I was presuming I might need to create four separate measures?

 

Thanks for any help you could provide.

RDF

3 REPLIES 3
RDF25087
Helper I
Helper I

RDF25087_0-1680770895608.png

 

RDF25087
Helper I
Helper I

@amitchandak  - thank you for the response.

 

Apologies for being a bit daft but how do I reference the M1 measure in the color measure? It's telling me [M1] is an unexpected expression.

 

Thanks

RDF

 

amitchandak
Super User
Super User

@RDF25087 , Create a measure like

 

M1= count(Table[Last Sale]) +0

 

Then create a color measure and use that in conditional formatting using field value option

 

 

Color =

var _diff=  datediff(max([Last Sales]), Today(), month)

Switch(true(),

[M1]= 0 , "Blue" ,

_diff <=1, "Green",

_diff <=3, "Yellow",

"Red"

)

 

How to do conditional formatting by measure and apply it on pie?
https://www.youtube.com/watch?v=RqBb5eBf_I4&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L
https://community.powerbi.com/t5/Community-Blog/Power-BI-Conditional-formatting-the-Pie-Visual/ba-p/...
https://amitchandak.medium.com/power-bi-where-is-the-conditional-formatting-option-in-new-format-pan...

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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