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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
cyborgandy
Helper II
Helper II

Matrix Color Formatting

Hi All, I have below dataset.

Compnay NameSpendFiscal YearDepartmentDivison
Water50002022SeaA
Rock100002022ForestB
Salt30002021SeaA
Rock10002022ForestB
Water60002021SeaA
Salt200002022SeaA
Water500002021SeaA
Water500002022SeaA


I have created below matrix in Power bi:

DivisionSea SpendForest SpendTop Company Name In spendSpend Of Top Company
A1340000Water50000
B011000Rock10000


Now I want to do color formatting for Sea Spend and Forest Spend , that if the unique count of company count is below or equal to 2 in that case color the row as green , if more than 2 then red however the unqiue count is not in the matrix , it is availble in the dataset, also under top compnay name i want to show the top company name with highest spend and in Spend table how much they have spend.

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

@cyborgandy Maybe:

Color Flag Measure =
  VAR __Table = DISTINCT('Table'[Company])
RETURN
  SWITCH(TRUE(),
    COUNTROWS(__Table)=2,1,
    COUNTROWS(__Table)>2,2,
    0
  )

Use this measure in your conditional formatting based on Rules.



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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hello @Greg_Deckler , This DAX didnt work.any other suggestion

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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.