Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
I would like to do conditional formatting on a table in PowerBI
where if the date is within the past 6 months it is green,
greater then 6 months it is yellow
and no date is orange.
Have tried everything and can't get it to work, thanks!
Solved! Go to Solution.
Hi,
It would be much easier if you posted some sample data.
Try creating a measure like this (you will need to change references to tables etc.)
Colour =
var vToday = TODAY()
var vProcessDate = MIN('Table'[LAST_Process_DATE])
var result =
SWITCH(
TRUE(),
ISBLANK( DATEDIFF(vProcessDate, vToday, MONTH)), "orange",
DATEDIFF(vProcessDate, vToday, MONTH) > 6, "yellow",
DATEDIFF(vProcessDate, vToday, MONTH) < 6, "green"
)
RETURN
result
Assign this to the formatting by field.
See attached PBIX.
| Have I solved your problem? Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;). |
Hi,
It would be much easier if you posted some sample data.
Try creating a measure like this (you will need to change references to tables etc.)
Colour =
var vToday = TODAY()
var vProcessDate = MIN('Table'[LAST_Process_DATE])
var result =
SWITCH(
TRUE(),
ISBLANK( DATEDIFF(vProcessDate, vToday, MONTH)), "orange",
DATEDIFF(vProcessDate, vToday, MONTH) > 6, "yellow",
DATEDIFF(vProcessDate, vToday, MONTH) < 6, "green"
)
RETURN
result
Assign this to the formatting by field.
See attached PBIX.
| Have I solved your problem? Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;). |
I have a table with LAST_Process_DATE as the dates
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 10 | |
| 9 | |
| 8 | |
| 7 |