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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

FabCon and SQLCon Highlights Carousel

FabCon & SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.