Forum Discussion

Sabz13's avatar
Sabz13
New Member
2 years ago

Bespoke icon for conditional formatting

Hi team, I need to create new bespoke icons using images from our comms team. So, for example, when a team name is used in a graph instead of the 'name' being displayed the 'icon/image' is displayed instead.


I have looked through the different forms around customising icons etc but can't see one on using a bespoke icon, and a proper step by step ‘dummies guide’ to getting this into the Power BI icon drop down list (as shown below).

Or is there a better way to do it? A rule when the 'text' is used then use the corresponding ‘image’? Not sure how that would work??


NOTE: All bespoke icons from comms are currently PNG files.

 

 

 

1 Reply

  • Hi Sabz13 

    Here are some suggested answers:

     

    Note 1: I have attached a JSON file containing 4 custom icons, and a PBIX using those icons.

    Note 2: In code blocks, the forum converts colon characters to &colon. If you are copying the code, please change these back to actual colon characters 🙂

     

    1. Adding Icons to Theme

     

    {
    "name": "Custom Icons",
      "icons": {
        "Checkers": {
          "description": "My Grey Checkers",
          "url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII"
        }
      }
    }

     

     

    2. Applying these icons in Power BI Desktop

    • After adding the Theme in Power BI Desktop, the icons are visible in the drop-down list in the Icon Conditional Formatting dialog box.
    • Note that the "description" shows on hover.
    • You can also create a measure that returns the icon's name (e.g. "Pennywise" in my example), and select this measure when using Format Style = Field Value.
    • In my PBIX, I added an "Icon" column to my table which contains valid icon names as text, and created a Selected Icon measure which retrieves the current text value from this column. As long as the value returned by the measure is a valid icon name, this will work fine.

     

    Selected Icon = 
    SELECTEDVALUE ( Score[Icon] )

     

     

    Some screenshots below:

     

    Icon drop-down menu:

    Field value method with measure [Selected Icon]

    Visual with conditional formatting using icons

     

    Regards,

    Owen