In Part 1 of this series, you learned how to use some of Power BI’s built-in.
In Part 2 you learned about Microsoft’s Theme Gallery.
In Part 3, you learned how to use the new Customize the Current Theme.
In Part 4, you learned how to export your customized theme and to use it in your future Power BI report projects.
In Part 5, you learned how to create a simple JSON theme file for your future Power BI report projects
In part 6, you learned about a few of the more common attributes used to customize the color of elements in the most common visualizations
In this post, you will see a few more of the more attributes used for specific visualizations. The first four are used for conditional formatting but only when you format the values using a color scale. In the figure below, you see the default colors used for a color scale with a divergent value. Typically, the divergent value is centered on the middle value. More specifically, it is the average value between the minimum and maximum value, not a median value as you might at first think.
In my sample Contoso data, I used this conditional formatting to color the background of the Sales Amount for each country. Immediate you should notice that most of the values have a red background and only the United States has a green background. The only obvious color variation is for a few countries down the list including: China, Germany, France, and Japan. The rest look very close to the same color as the minimum color. The reason for this is that middle value is (1,951,503,966.95 + 4,693,341.12) / 2 or 979,598,654.04 is significantly larger than most of the values in the table. While China comes the closest to this value, it is still only 2/3 of the middle value. Therefore, even it has a color that is on the red side of yellow (the ‘center’ color) on the scale.
One way to provide more color variation is to change how the divergent color is defined. Instead of using the middle value, click the dropdown to the right of ‘Middle value’ and select Custom. Then enter a value that you want to be the center. You could determine the median value. However, I’m just going to enter 50,000,000.00
This change results is a significant improvement in the color gradients between the different country’s sales as shown in the next figure.
Using these default conditional colors could pose a problem for those who are red-green color blind in that they will not be able to easily determine by color alone which countries have the greatest sales. According to the Americans with Disabilities Act (ADA), this needs to be corrected. Now that you know how to build themes, you determine that you can set these colors using four new attributes (Remember, these only apply when the conditional formatting is defined with a color scale.):
Maximum: Defines the color of the maximum value.
Center: Defines the divergent color for either the Middle value or Custom value
Minimum: Defines the color of the minimum value.
Null: Defines the background color for any null value.
Suppose I defined a JSON file as follows.
When I apply this custom theme, my sales table conditional formatting changes to look like this:
You might be interested to know that if you are using the new Customize Theme tool, these colors (except for NULL) correspond to the Divergent colors found on the Name and Colors page of the tool.
Next, there is another set of colors that are used in waterfall charts and KPI visualizations. But what are these visualizations and why would you use them.
What is a waterfall chart? A Waterfall chart is a type of column chart that shows the change in a value from one period to the next. A line between two adjacent columns indicates the value of the measurement between the two time periods. If the right-side column rises, this is generally considered good. It the column falls, this is generally considered bad. Personally, you might want to use a waterfall chart to visually display the monthly fluctuation in your stock portfolio. The resulting waterfall chart can show the increases and decreases of your investment on a monthly basis over a year. The first column (leftmost) indicates the performance of your portfolio in the first time period (month). In the figure below, the initial investment of $50,000 fell $500 in the first month. The last column (rightmost) indicates the performance during the last period (month) which in the figure shows an increase of $2,470. The difference between the last column and the first column indicates the overall performance of the portfolio. In this figure, the difference between the start value of $50,000 and the ending value of $100,000 indicates a doubling of the investment in the year. Note that this chart displays the actual investment values. However, it is also possible to create a chart that works only with differences from the initial period and thus would start at zero.
What is a KPI? KPI stands for Key Performance Indicator. They are used to measure a business factor and compare it to a goal rather than to just measure the change from the prior period such as in a waterfall chart. For example, if your company has a goal of growing sales 1% per month, you could then measure actual sales against this goal value to determine whether you are exceeding, meeting or falling behind that goal.
The colors used for these two different visualizations correspond to the following JSON attributes:
Good: Exceeding a KPI goal or an increase in the measured value during the current time period in a waterfall chart.
Neutral: Meeting a KPI goal or no change in the measured value during the current time period in a waterfall chart.
Bad: Falling behind a KPI goal or a decrease in the measured value during the current time period in a waterfall chart.
However, as in the case of the conditional formatting colors, the default colors use both red and green which could be a problem for those with red-green color blindness. These colors for KPIs and Waterfall charts can be found the Customize Theme tool in the Sentiment Colors area of the Name and Colors page.
Therefore, you might want to change one or both colors as shown in the following JSON code:
After applying the theme, you can see that the Sentiment colors have been updated.
I’ll leave it as an exercise for you to try this with your own data.
We still have a little more to examine as we dive even deeper into the JSON behind the themes.
C’ya next time.