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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
JamesGordon
Helper II
Helper II

Conditional Format Matrix on Average of row total

Hi all,

 

I am trying to add some conditional formatting to a matrix table but struggling to get the correct result.

 

I am trying to make the value in the table turn either Green or Red. Green if the value in the cell is greater than the Average of the row total and Red if it is below. Screenshot attached with the result i am after.

 

i.e if the total is £155,750 and there are 4 entries then £155,750/4 - £38,937.5 Any values greater than this in that row can be Green. Obviously each row has different averages.

 

I have created a measure to calculate the average per row-

myAverage = divide(sum(Sheet[Total Sell]),distinctcount(Sheet[Rep]))
 
But i cannot get the conditional formating to work?
 
Any ideas?
Matrix.jpg
1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@JamesGordon Have you checked that calculation in context of the individual cells? Seems like you would need something like:

myAverage = divide( CALCULATE(sum(Sheet[Total Sell]),ALLEXCEPT(Sheeet[Make])),CALCULATE(COUNTROWS(DISTINCT(Sheet[Rep])),ALLEXCEPT(Sheet[Make])))


Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @JamesGordon,

Can you please share a pbix or some dummy data that keep raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

Greg_Deckler
Super User
Super User

@JamesGordon Have you checked that calculation in context of the individual cells? Seems like you would need something like:

myAverage = divide( CALCULATE(sum(Sheet[Total Sell]),ALLEXCEPT(Sheeet[Make])),CALCULATE(COUNTROWS(DISTINCT(Sheet[Rep])),ALLEXCEPT(Sheet[Make])))


Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 

Thank you,  thats appears to give me the average of the row total so getting nearer. But how can i now make that figure colour coordinate the individial cells?

Try coloring based on a measure like

SUM ( Sheet[Total Sell] ) - [myAverage]

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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