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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

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
October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.