Forum Discussion

nh27's avatar
nh27
Helper III
3 years ago
Solved

DAX Measure for Traffic Light System

I have a number of matrix visuals where at the moment I am applying conditional formatting using the icons and recently discovered I can apply a measure to this which will speed things up greatly, however I can't seem to get the exact measure replicated and hoping someone here can advise where I'm going wrong in my measure:

Many thanks in advance

  • You can either:

    a) Use the [Accounting ACT/FCT%] measure itself to establish the rules for the conditional formatting. Here is an example (in my case evaluating the results of [Score on last date measure]):

    So as you see, you set the actual values to be evaluated in the rules.

     

    b) Create a specific measure wich precomputes the results (similiar to your approach):

    In this example, the measure created to be used for the Conditional Formatting rules is:

    Icon CF = 
    SWITCH(
        TRUE(),
        [Score on last date] < 5, 1,
        [Score on last date] < 10, 2,
        3)

    and you then set up the conditional formatting rules referencing the Switch possible outputs:

     

    Make sense?

3 Replies

  • PaulDBrown's avatar
    PaulDBrown
    Community Champion

    You can either:

    a) Use the [Accounting ACT/FCT%] measure itself to establish the rules for the conditional formatting. Here is an example (in my case evaluating the results of [Score on last date measure]):

    So as you see, you set the actual values to be evaluated in the rules.

     

    b) Create a specific measure wich precomputes the results (similiar to your approach):

    In this example, the measure created to be used for the Conditional Formatting rules is:

    Icon CF = 
    SWITCH(
        TRUE(),
        [Score on last date] < 5, 1,
        [Score on last date] < 10, 2,
        3)

    and you then set up the conditional formatting rules referencing the Switch possible outputs:

     

    Make sense?

    • nh27's avatar
      nh27
      Helper III

      Thanks for the prompt response PaulDBrown but the problem is I have already referenced the measure in the field to base the conditional formatting on but it's not picking up the correct references (see attached)

       

      Thanks

      • PaulDBrown's avatar
        PaulDBrown
        Community Champion

        That means the references used in the measure are not recognised. Ie, DAX doesn't  know what "CircleLow" etc are with regards to conditional formatting.  It will recognise Hex codes or colour names though. I suggest you try one of the methods posted.