5 Status Indicator

Hi,

Is there any way that I can create a traffic light status for 5 colour? I already watch the SQLBI using tabular editor, however, I could not get it right.

This is my formula

Status = 
VAR Ratio = [Sales to Salary Ratio]
VAR RatioTolerance = 2
VAR RatioGoal = 6

RETURN
    IF (
        NOT ISBLANK ( Ratio ),
        SWITCH (
            Ratio < RatioTolerance, -2,
            RatioTolerance < Ratio < RatioGoal - RatioTolerance, -1,
            RatioGoal - RatioTolerance < Ratio < RatioGoal, 0,
            RatioGoal < Ratio < RatioGoal + RatioTolerance , 1,
            Ratio > RatioGoal + RatioTolerance, 2
        )
     )

Sure … conditional formatting can do this, no problem. Much easier to describe the method specifically if you can attach your work-in-progress PBIX and an Excel mock-up of your desired outcome.
Greg

P.S.: if you include DAX in your posts, please format it using the built-in editor
_eDNA Forum - Format DAX

@Amirul,

Absolutely. There are a number of different ways you can do this.

First, instead of using SWITCH here, I think what would work better is SWITCH(TRUE). See @sam.mckay’s excellent video below on how to set that up:

For each true condition, instead of returning a number you will want to return a UNICHAR() code for your stoplight icon. Here’s a big list of codes – take a look at the geometric shapes section for colored circles you can use as stoplight indicators.

However, rather than using UNICHAR() codes, I think you can get a much better look by using hosted custom icons. Take a look at my Problem of the Week #5 solution for an example of this technique:

If you want to go this route, I explain in detail how to do it in my Data Challenge #7 write up:

I hope this is helpful.

  • Brian

PS – conditional formatting is another way to do this, but you are very limited in the icon sets you can use. However, if you do like the icons available in the conditional formatting, that’s probably the easiest way to accomplish what you want to do.

Thats lovely Brian. Thank you so much.

Thank you also Greg. For showing me how to use the textbox.

Hi @Amirul. I hope that you are having a great experience using the Support Forum so far. We’ve recently launched the Enterprise DNA Forum User Experience Survey, please feel free to answer it and give your insights on how we can further improve the Support forum. Thanks!