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 all please help me to create a calculated column to achieve this with color.
| If Finish Date < 5-10 weeks than Milestone then "Green" |
| If Finish Date < 2-5 weeks than Milestone then "Yellow" |
| If Finish Date >= than Milestone then "Red" |
"
PS: Both are date columns with hierarchy.
Solved! Go to Solution.
Hi @harshagraj
your conditions is completely unclear and not consistent, but i can suggest smth like this
Column =
var _datediff = DATEDIFF([Finish Date],[Milestone], WEEK)
RETURN
SWITCH(TRUE(),
_datediff > 5 && _datediff < 10, "Green",
_datediff > 2 && _datediff < 5, "Yellow",
_datediff <= 0, "Red",
BLANK()
)
Hi @harshagraj
your conditions is completely unclear and not consistent, but i can suggest smth like this
Column =
var _datediff = DATEDIFF([Finish Date],[Milestone], WEEK)
RETURN
SWITCH(TRUE(),
_datediff > 5 && _datediff < 10, "Green",
_datediff > 2 && _datediff < 5, "Yellow",
_datediff <= 0, "Red",
BLANK()
)
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!