Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin 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.
Hi All, I have below dataset.
| Compnay Name | Spend | Fiscal Year | Department | Divison |
| Water | 5000 | 2022 | Sea | A |
| Rock | 10000 | 2022 | Forest | B |
| Salt | 3000 | 2021 | Sea | A |
| Rock | 1000 | 2022 | Forest | B |
| Water | 6000 | 2021 | Sea | A |
| Salt | 20000 | 2022 | Sea | A |
| Water | 50000 | 2021 | Sea | A |
| Water | 50000 | 2022 | Sea | A |
I have created below matrix in Power bi:
| Division | Sea Spend | Forest Spend | Top Company Name In spend | Spend Of Top Company |
| A | 134000 | 0 | Water | 50000 |
| B | 0 | 11000 | Rock | 10000 |
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.
@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.
| User | Count |
|---|---|
| 11 | |
| 9 | |
| 8 | |
| 7 | |
| 6 |