2024 Week 26 | Power BI: Reference Theme Sentiment Colors in DAX

Introduction

Power BI reports have a theme that specifies the default colors, fonts, and visual styles. In Power BI Desktop, you can choose to use a built-in theme, start with a built-in theme and customize it, or create your own theme. 

In addition to the primary data colors, we can also define sentiment colors and divergent colors in our theme. The data colors and sentiment colors from a built-in theme are shown below.

Screenshot of the customize theme dialog in Power BI Desktop, showing data colors and theme colors

This week’s challenge is to use the negative, positive, and neutral colors defined in the theme as part of conditional formatting in a visual. If you change the sentiment colors in the theme or switch themes (assuming the new theme has different sentiment colors defined), the colors in your visual should change. 

Requirements

1. Retrieve the data from Data.World

2. Create cards or KPI boxes to show the median, average, minimum, and maximum quiz score from the dataset.

3. Create a bar chart that contains one bar per student where the length of the bar represents the quiz score. Add a reference line to show the median test score.

4. Use conditional formatting to color the bars as follows:

  • If the score variance from the median is greater than 5%, the color should match the positive theme color. 
  • If the score variance from the median between -5% and 5%, the color should match the neutral theme color.
  • If the score variance from the median is less than -%5, the color should match the neutral theme color.

5. Create a legend (can be outside of the bar chart visual) to explain the colors of the bar.  

Dataset

You can find this week’s data on Data.World at https://data.world/mlongoria/wow2024wk26/

There is a single table in the dataset.

Note: Data.World requires you to create a free account to access the data. You may use the Data.World connector in Power BI or download the file to your local machine and connect to it there.

Share

After you finish your workout, share on Twitter or LinkedIn using the hashtags #WOW2024 and #PowerBI. If you share on Twitter, please tag @MMarie, @shan_gsd, @KerryKolosko. Also make sure to fill out the Submission Tracker so that we can count you as a participant this week in order to track our participation throughout the year.

Solution

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top