Forum Discussion

askpbiuser's avatar
askpbiuser
Helper I
2 years ago

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