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!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
Hello,
II need to make the dates in the table different in color according to the expiration date of the product. If there are more than 3 months from today to the end of the expiration date, the dates will be green, if there will be less than 3 months from today to the end of the expiration date, the date will be orange, and if today is already after the expiration date, the date will be red.
Do you know how to do that ?
Thank you.
Jaroslav
You can use a measure expression like this one and use it in the backgroun conditional formatting for the ExpDate field in a table visual.
DateColor =
VAR maxdate =
MAX ( Expiries[ExpDate] )
VAR DaysUntilExpiry =
INT ( maxdate - TODAY () )
VAR color =
SWITCH (
TRUE (),
DaysUntilExpiry >= 90, "Green",
DaysUntilExpiry >= 0, "Orange",
"Red"
)
RETURN
color
Pat