Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
byr10112
Employee
Employee

Conditional formatting of a measure based on another measure

I'm trying to get a matrix conditionally formatted based on the results of a measure. The matrix currently includes the percent of available sources used by the employees, which is a measure. For example, if there are 100 sources available to be used and an employee used 60 of those sources, the source utilization of the employee is 60%. The source utilization is a measure, where I divide the Number of Sources Used by the Number of Sources Available. The employee names populate the rows and the Months are the columns in the matrix. 

 

I also have a separate measure called target, which changes based on the month. For example, the target utilization of sources is 80%, meaning we expect the employees to use at least 80 sources from the available 100. The target ranges from 40 in January to 90 in July. The target measure is calculated as Target Sources/  Number of Sources available.

 

I have two separate tables, one for the actual numbers and the other for the target. Targets are company-wide targets and do not change based on the empoyee. The employee util table has Employee, Month, Sources Used and Sources Available. The target table has  Month, Sources Targeted and Sources Available info. 

 

I would like to color code my matrix values based on whether the employee's source usage meets the target or not. If the employee's source util is less than the target util, the cell should be filled in Red, and Green if the source util is greater than or equal to target util.  

 

Is there a way for me to do this? Below is the sample data:

Employee Table:

EmployeeMonthSources UsedSources Available
Peter JacksonJanuary85100
Adam DevineJanuary74100
John SmithMarch6595
Peter LucasJune67108

Measure: Employee Util = SUM(Sources Used) / SUM(Sources Available)

 

 

Target Table:

MonthSources AvailableTarget 
January10080
February10984
March9571
April9167

Measure: Target Util = SUM(Target)/ SUM(Sources Available)

 

Matrix:

 

EmployeeJanuaryFebruaryMarchAprilMay
Peter Jackson.85

.90

.79.55.78
Adam Devine.74.87.55.87.94
John Smith.64.57.68

.34

1.0
Peter Lucas.67.64.94.46.56

Depending on the target, the cell should be either red or green as mentioned above. 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Have you tried the built-in conditional formatting feature in Power BI?

elofstrom_0-1644000616812.png

You can conditionally format one measure by a different measure as well.  So you could create a measure that checks to see if the Sources Used % > Target Used % and then color by that.

elofstrom_1-1644000768850.png

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Have you tried the built-in conditional formatting feature in Power BI?

elofstrom_0-1644000616812.png

You can conditionally format one measure by a different measure as well.  So you could create a measure that checks to see if the Sources Used % > Target Used % and then color by that.

elofstrom_1-1644000768850.png

 

Greg_Deckler
Super User
Super User

@byr10112 Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

I added some sample data

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.