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