# Highlight Min & Max Values for each Row in matrix visual

Hi guys,

Today , I would like to know if someone has ever done the highlighting of Min & Max value for each row in a matrix visual. I am able to find the max & min values for the entire matrix but not able to figure out a way to highlight the max & min for each row.

e.g for first row that has advance as category the values 300 & 450 should be highlighted.

Regards,
Hemant

Highlight_Each_Row_for_Max&Min.pbix (23.8 KB)

Hi @Hemantsingh,

Thanks for posting a clear requirement with sample PBIX
Judging your initial measure, I canât help but think you were so close to resolving this on your ownâŚ

5 Likes

Hi @Melissa,

I am just laughing on myself. Thanks a lot for the correction. I just didnât see this at all.

Regards,
Hemant

I would like to know if someone has ever done the highlighting of Min & Max value for each COLUMN in a matrix visual. I am able to find the max & min values for the entire matrix but not able to figure out a way to highlight the max & min for each COLUMN not row.

your code work as charm but my goal to apply it on column so for East the max will be 400 and Min will be 120 and so on per column.

Thank you

Welcome to the forum.
In future please create a new thread, that way other members can find and thus benefit from it as well.

It needs just a small modification to highlight min & max for columns, as illustrated below.

Min & Max for Each Column =
VAR _Table =
CALCULATETABLE(
SUMMARIZE( Sales, 'Material Group'[Category], Region[Region] ),
"@SalesAmt", [Sum_of_Sales_Amount]
),  ALL( 'Material Group'[Category] )
)
VAR _Min = MINX(_Table, [@SalesAmt])
VAr _Max = MAXX(_Table, [@SalesAmt])
VAR CurrentVal = [Sum_of_Sales_Amount]
VAR Result =
SWITCH(
TRUE(),
CurrentVal = _Min,0,
CurrentVal = _Max,1
)
RETURN
Result

.
With this result.

The sample file:
Highlight Max & Min in Matrix.pbix (25.0 KB)

.

@EnterpriseDNA @jeanrose87 could you please split this thread into a new one with this title: Highlight Min & Max Values for each Column in a matrix visual.
Thank you.

ok sorry for that.
i did what you send exactlly in row version and working as charm, but when shift it as per your examble to column its become nightmare

this the code
VAR Vals =
CALCULATETABLE (
SUMMARIZE (
DIM_WON_ANALYTICS,
//âRootâ[Name EN],
âServices Listâ[Name EN],
âDateâ[UNMMAE]
),
â@SalesAmtâ, [Best Selling Product Value]
),
//ALLSELECTED ()
//ALL ( âDateâ[UNMMAE] )

All ( 'Services List'[Name EN] )

)

VAR MinValue =
MINX ( Vals, [@SalesAmt] )
VAR MaxValue =
MAXX ( Vals, [@SalesAmt] )
VAR CurrentValue = [Best Selling Product Value]
VAR Result =
SWITCH (
TRUE,
CurrentValue = MinValue, 1,
â 1 for MIN
CurrentValue = MaxValue, 2 â 2 for MAX
)
RETURN
Result

this the result as you see all become red