Conditional Formatting in Power BI

Author by Megan Dehn

Yes, I made it to blog 5!!! Woohoo!!!!!!! This is my most exciting blog yet...so stay tuned. 

Some of the interns are working on a Modernization project for the Concurrency ICE site, and I thought I’d help them out with some of the data visualization. An intern sent out a survey for all Concurrency employees to take regarding what changes they would like to see on the site. One of the questions asked: “How important would these features on the new Concurrency Intranet Homepage be to you as an employee on a scale of 1 to 5?”

The options listed were:

Company Updates/News

Yammer Feed

Employee Directory

Training resources and information links

IT Support links

Company Events Calendar

Employee policy documentation and resource links

Concur/Expense reimbursement links

To visualize these responses, I created tables for every option. The following table represents the results of how Concurrency employees feel about a Yammer feed on the home page.

yammer-pic.JPG

To make this table stand out, I chose to apply conditional formatting by highlighting the maximum value. You can do some conditional formatting with a few simple clicks in Power BI, but this required hard coding in DAX. The following code represents a new measure called "yammer". This works by first creating a variable called "yam". The ALLSELECTED() function returns all the rows in the Yammer Feed column. Next, I created a variable called "themaxvalue". This is counting the number of users who responded 1 through 5. Lastly, I present an IF() function that finds the maximum count and highlights it yellow.

cond-format-dax-(1).JPG

When I apply this measure to conditional formatting like below,

background-(1).JPG 

I am able to create the following tables. For each table, the measure that you use stays the same, despite the type of question that you are analyzing. 

tables-(1).JPG

This type of conditional formatting is really nice when you want to focus on a specific part of your data, like the minimum, maximum, or average. This is also really nice to use when you want to highlight a part of data on a histogram or scatter plot.