Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
During the July 2019 Power BI Desktop update, Amanda Cofsky mentioned that conditional formatting colors could be set using a JSON theme file. She mentions it around the 5:20 mark of this video: https://youtu.be/l7OMRUF9UYg?t=320
Does anyone have the correct code that I could use to add this to my JSON theme?
Solved! Go to Solution.
The September 2019 Power BI Desktop update video had a spot that finally showed the correct syntax to do this!
"maximum": "#00b050",
"center": "#ffff00",
"minimum": "#c00000",
Based on newer updates -
You can set the diverging colors by customising your current theme. Once set, they are your default colors
Hi NickTrent32,
The code in video is correct, you could copy code like below in notepad, then save this as json file, and import this in powerbi, it should work
{ "name": "St Patricks Day", "icons": { "test":{ "url":"https://i.gifer.com/Omjx.gif", "description":"test" } } }
Or you also could use gif in conditional format icon directly without importing it. You could try to use measure like below (use this directly by referring to its link)
Icon Set Measure = SWITCH ( TRUE (), [% Change vs Prior Year] < 0, "data:image/svg+xml;utf8, <svg xmlns='http://www.w3.org/2000/svg' x='0px' y='0px' width='100' height='100' viewBox='0 0 100 100'> <circle cx='50' cy='50' r='40' stroke='purple' stroke-width='4' fill='purple' /> </svg>", [% Change vs Prior Year] < 0.4, "data:image/svg+xml;utf8, <svg xmlns='http://www.w3.org/2000/svg' x='0px' y='0px' width='100' height='100' viewBox='0 0 100 100'> <circle cx='50' cy='50' r='40' stroke='green' stroke-width='4' fill='yellow' /> </svg>", "https://i.gifer.com/4Ym4.gif" -- "https://i.gifer.com/Omjx.gif" )
You could refer to Conditional Formatting Using Icons In Power BI for details.
Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Sorry @dax , I should have been more clear. I would like to set the default Minimum, Center, and Maximum colors in the screenshot below using a JSON theme.
Is that possible?
Hi NickTrent32,
At first, we can't use custom icon whe you set color conditional format. If you want to set custom color theme, you could try below json
{ "name": "St Patricks Day", "dataColors": ["#568410", "#3A6108", "#70A322", "#915203", "#D79A12", "#bb7711", "#114400", "#aacc66"], "background":"#FFFFFF", "foreground": "#3A6108", "tableAccent": "#568410" }
Then you will get below result
If you want to set custom icon based on condition, you could use JSON to import this in report like my irst reply sample, then use this liek below
Or you don't need to import cutsom icon by json, you could use this directly. You could create measure like below
Measure 2 = SWITCH ( TRUE (), [Measure 3]<=5, "https://i.gifer.com/Omjx.gif", [Measure 3] <10, "https://i.gifer.com/KhAg.gif" , "https://i.gifer.com/4Ym4.gif" -- "https://i.gifer.com/Omjx.gif" )
You could see coresponding image information in above meaurse, then set cinditional icon like below
Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Apologies again if I'm not being clear, @dax. This question/request do not have anything to do with icons. The reason I mentioned the video is because during that video, while talking about using JSON for icons, Amanda seems to also mention that a JSON theme could be used to set Conditional Formatting colors.
I am already using a JSON theme to apply a new color scheme for my organization. What I would like to do is also use that JSON theme to change the default default Minimum, Center, and Maximum colors.
In fact, those colors do not even inherit the color scheme I am applying through a JSON them.
Hi NickTrent32,
Did you try above sample for color theme, then import this to report? when you import this in report, you could choose corresponding color
Or you could click on custom colr to type corresponding color to set color(which might not inherit the theme color)
Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @dax - Yes, I understand that I can manually select a color from a color palette set by a them for the Minimum, Center, and Maximum colors or type in a hex code.
My question is, can I set those Minimum, Center, and Maximum colors using a JSON theme, rather than having to manually select the color from a color palette each time? Also, the colors I want to select are different than the colors I have set in my color palette.
The September 2019 Power BI Desktop update video had a spot that finally showed the correct syntax to do this!
"maximum": "#00b050",
"center": "#ffff00",
"minimum": "#c00000",
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
87 | |
87 | |
85 | |
67 | |
49 |
User | Count |
---|---|
135 | |
112 | |
100 | |
66 | |
62 |