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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
Anonymous
Not applicable

Matrix formatting

I want to highlight each row with its lowest and highest values in my matrix , I am using a measure currently to conditional format and its not working well,

MinMax1 =

VAR Vals =
CALCULATETABLE(
ADDCOLUMNS (
SUMMARIZE ( HoldTime, HoldTime[IRC],HoldTime[Team],HoldTime[CallInitiatedTime - Hour]),
"@hold", [Hold Duration (MM:SS)]
),
ALLSELECTED())
VAR MinValue = MINX ( Vals, [@hold] )
VAR CurrentValue = [Hold Duration (MM:SS)]

VAR MaxValue = MAXX ( Vals, calculate([Hold Duration (MM:SS)],filter(Vals,Vals=CurrentValue)))
VAR Result =
SWITCH (
TRUE,
CurrentValue = MinValue, 1, -- 1 for MIN
CurrentValue = MaxValue, 2 -- 2 for MAX
)
RETURN
Result
need help on how to tweak the measure
 
2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , try like

 

MinMax1 =

VAR Vals =
CALCULATETABLE(
ADDCOLUMNS (
SUMMARIZE (allselected( HoldTime), HoldTime[IRC],HoldTime[Team],HoldTime[CallInitiatedTime - Hour]),
"@hold", [Hold Duration (MM:SS)]
),
ALLSELECTED())
VAR MinValue = MINX ( Vals, [@hold] )
VAR CurrentValue = [Hold Duration (MM:SS)]

VAR MaxValue = MAXX ( Vals, calculate([Hold Duration (MM:SS)],filter(Vals,Vals=CurrentValue)))
VAR Result =
SWITCH (
TRUE,
CurrentValue = MinValue, 1, -- 1 for MIN
CurrentValue = MaxValue, 2 -- 2 for MAX
)
RETURN
Result

 

 

or

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thanks for your response, I just did a workaround and struck here,

 

HoldTimeCompare = var _17 = if(HoldTime[Hold Duration (MM:SS)]<blank(),CALCULATE(HoldTime[Hold Duration (MM:SS)],filter(HoldTime,HoldTime[CallInitiatedTime - Hour]=17)))
var _18 = CALCULATE(HoldTime[Hold Duration (MM:SS)],filter(HoldTime,HoldTime[CallInitiatedTime - Hour]=18))
var _19 = CALCULATE(HoldTime[Hold Duration (MM:SS)],filter(HoldTime,HoldTime[CallInitiatedTime - Hour]=19))
var _20 = CALCULATE(HoldTime[Hold Duration (MM:SS)],filter(HoldTime,HoldTime[CallInitiatedTime - Hour]=20))
var _21 = CALCULATE(HoldTime[Hold Duration (MM:SS)],filter(HoldTime,HoldTime[CallInitiatedTime - Hour]=21))
var _22 = CALCULATE(HoldTime[Hold Duration (MM:SS)],filter(HoldTime,HoldTime[CallInitiatedTime - Hour]=22))
var _23 = CALCULATE(HoldTime[Hold Duration (MM:SS)],filter(HoldTime,HoldTime[CallInitiatedTime - Hour]=23))
var _0 = CALCULATE(HoldTime[Hold Duration (MM:SS)],filter(HoldTime,HoldTime[CallInitiatedTime - Hour]=0))
var _1 = CALCULATE(HoldTime[Hold Duration (MM:SS)],filter(HoldTime,HoldTime[CallInitiatedTime - Hour]=1))
VAR __list = { _17,_18,_19,_20,_21,_22,_23,_0,_1 }
var maxlist =
CALCULATE(MINX( __list,[value] ),ALLEXCEPT(HoldTime,HoldTime[IRC],HoldTime[Team],HoldTime[CallInitiatedTime - Hour]))

var Maxi = if(maxlist=CALCULATE(minx(HoldTime,HoldTime[Hold Duration (MM:SS)]),ALLEXCEPT(HoldTime,HoldTime[Team],HoldTime[IRC],HoldTime[CallInitiatedTime - Hour])),1,0)


return Maxi
now for the maxi variable, i want to return only the top 1
How can I achieve this?
 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.