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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
JaroslavZB
New Member

Date sort by color

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

1 REPLY 1
ppm1
Solution Sage
Solution Sage

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

ppm1_0-1675616072651.png

Pat

Microsoft Employee

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

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
Top Kudoed Authors