Forum Discussion
Highlight minimum value for each column in Matrix
Hi All,
I am new to Power BI and working on highlighting the value which is lowest in a column. I have a matrix with Customer in Rows, column B in columns coming from Mat table and say Values in values.Screenshot below -
I want to highlight 8.67 value but it is visible when i put the background field next to it for testing and if I remove it, i dont see the colour anymore (which is the ask). Also i observe lot of inconsistency with this code.
Code that i wrote but is not working as expected -
Background Color by Customer =
VAR _1 = CALCULATETABLE(
ADDCOLUMNS
(SUMMARIZE('Fact','Dim Customer'[Customer], 'Mat'[B]),
"@NET", [Value]
),
ALLSELECTED('Dim Customer')
)
VAR MinValue = MINX ( FILTER(_1, [@NET] <> BLANK()), [@NET] )
VAR MaxValue = MAXX ( _1, [@NET] )
VAR CurrentValue = [Value]
VAR Result =
SWITCH (
TRUE,
CurrentValue = MinValue, 1, -- 1 for MIN
CurrentValue = MaxValue, 2 -- 2 for MAX
)
RETURN
Result
My table can have blank values and i need to ignore those. Also i have slicers on this page coming from different tables. I do have a filter implented to this matrix too coming from Fact table to check for valid records ( flad where isvalid = true).
Please help!
1 Reply
- amitchandakSuper User
askpbiuser , Create a measure like the below Assuming the value is measure and use that in conditional formatting using field value option
COlor =
var _tab = SUMMARIZE('Fact','Dim Customer'[Customer], 'Mat'[B],"@NET", [Value])
Return
Switch(True(),
[Value] = maxx(_tab, [@Net]), "Green",
[Value] = minx(_tab, [@Net]), "Red"
)How to do conditional formatting by measure and apply it on pie?
https://www.youtube.com/watch?v=RqBb5eBf_I4&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L
https://community.powerbi.com/t5/Community-Blog/Power-BI-Conditional-formatting-the-Pie-Visual/ba-p/1682539
https://amitchandak.medium.com/power-bi-where-is-the-conditional-formatting-option-in-new-format-pane-66e0afcb15f3