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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
siddrow
Helper III
Helper III

Traffic light conditional formatting help

Hi

 

I created the below measure to use on the table visual in the cell element>font colour section. It doesn't allow me to put it in there (see below screenshot of red box that appears).

 

siddrow_0-1722986958672.png

 

 

Due date, status and % complete are all columns from my dataset which comes from Sharepoint Lists, none are measures, calculated or custom columns.

 

Traffic Lights Colour =
    var _a= min('List'[Due Date])
    var _b= min('List'[Status])
    var _c= min('List'[% Complete])
return
    SWITCH(TRUE(),
    _a<=30 & _a>14 && _b="Not Started" && _c<=50,"#f58021",
    _a<=30 & _a>14 && _b="In Progress" && _c<=50,"#f58021",
    _a<=14 && _b="In Progress" && _c<=50,"#ee3224",
    _a<=14 && _b="Not Started" && _c<=50,"#ee3224",
    "#709302")
 
Basically trying to say:
 
if due date is equal to or less than 30 days but more than 14 days (from today) and status is "not started" and % complete is equal to or less than 50% then turn orange
 
if due date is equal to or less than 30 days but more than 14 days (from today) and status is "in progress" and % complete is equal to or less than 50% then turn orange
 
if due date is equal to or less than 14 days (from today) and status is "in progress" and % complete is equal to or less than 50% then turn red
 
if due date is equal to or less than 14 days (from today) and status is "not started" and % complete is equal to or less than 50% then turn red
 
else turn green
 
thanks in advance.
1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @siddrow 
It seems a syntax issue in the attached code :

Ritaf1983_0-1723197604248.png

Try to modify it to :

Traffic Lights Colour =
    var _a= min('List'[Due Date])
    var _b= min('List'[Status])
    var _cmin('List'[% Complete])
return
    SWITCH(TRUE(),
    _a<=30 && _a>14 && _b="Not Started" && _c<=50,"#f58021",
    _a<=30 && _a>14 && _b="In Progress" && _c<=50,"#f58021",
    _a<=14 && _b="In Progress" && _c<=50,"#ee3224",
    _a<=14 && _b="Not Started" && _c<=50,"#ee3224",
    "#709302")

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

1 REPLY 1
Ritaf1983
Super User
Super User

Hi @siddrow 
It seems a syntax issue in the attached code :

Ritaf1983_0-1723197604248.png

Try to modify it to :

Traffic Lights Colour =
    var _a= min('List'[Due Date])
    var _b= min('List'[Status])
    var _cmin('List'[% Complete])
return
    SWITCH(TRUE(),
    _a<=30 && _a>14 && _b="Not Started" && _c<=50,"#f58021",
    _a<=30 && _a>14 && _b="In Progress" && _c<=50,"#f58021",
    _a<=14 && _b="In Progress" && _c<=50,"#ee3224",
    _a<=14 && _b="Not Started" && _c<=50,"#ee3224",
    "#709302")

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.