Forum Discussion
JaroslavZB
3 years agoNew 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
- ppm1
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 colorPat