Forum Discussion

ld17's avatar
ld17
Helper II
3 years ago
Solved

Using conditional formatting icons for text

I would like to set up conditional formatting on my matrix so that a yellow, red, or green icon shows up in the cell depending on whether the user has completed it or not. If the user has completd it, a date will display (would like a green icon to show up next to the date). If the user has not completed it, the cell will either have "not assigned," "in progress," "or registered" in it (would like a yellow or red icon here). The issue is that the default options for conditional formatting only allow me to input percentage, and there are no percentages in my data, just a date or "in progress," "registered," etc. I cannot find an option to change this so that I can input text for conditional formatting. A screenshots is below:

 

 

  • Hi, ld17 

    You can try to use this dax code:

    Measure 2 = var _flag= MAX('Table'[Column1])
    return
    SWITCH( TRUE() , 
    _flag="deleted" , 1,
    _flag="in progress" , 2,
    _flag="registered",3,
    IFERROR(DATEVALUE(_flag),-1)<>-1,4
    )

    The configuration need to add '4':

    The result is as follows:

    Best Regards,

    Aniya Zhang

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

4 Replies

  • Hi , ld17 

    According to your description, you want to add a conditional formatting icons for a text .

    Here are the steps you can refer to :
    [1] First method , we can add a measure to just return the image, like this:

    Measure = var _flag= MAX('Table'[Column1])
    return
    SWITCH( _flag , 
    "deleted" , "🔴",
    "in progress" , "🟢",
    "registered","🟡")

    Then we just need to put the measure on the visual and we can meet your need:

     

    [2]Second , we can also add a measure as the judgement to the "conditional formatting icons".

    Measure 2 = var _flag= MAX('Table'[Column1])
    return
    SWITCH( _flag , 
    "deleted" , 1,
    "in progress" , 2,
    "registered",3)

    Then we configure the "conditional formatting icons":

    We can also meet your need , the result is as follows:

     

    [3]The third method can add some custom icon in power bi , if you need , you can refer to :
    Include Custom Icons in Your Tables - Microsoft Power BI Community

     

    Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

     

    Best Regards,

    Aniya Zhang

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

  • Thanks so much for the solution. This works well. One question: if a completed training displays as a date rather than the text "completed," what value should I be putting below?

     

     

    • v-yueyunzh-msft's avatar
      v-yueyunzh-msft
      Community Support

      Hi, ld17 

      You can try to use this dax code:

      Measure 2 = var _flag= MAX('Table'[Column1])
      return
      SWITCH( TRUE() , 
      _flag="deleted" , 1,
      _flag="in progress" , 2,
      _flag="registered",3,
      IFERROR(DATEVALUE(_flag),-1)<>-1,4
      )

      The configuration need to add '4':

      The result is as follows:

      Best Regards,

      Aniya Zhang

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

      • ld17's avatar
        ld17
        Helper II

        This works perfect. Thanks so much!