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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
dwelsh
Advocate I
Advocate I

Matrix with Max Value in Row Highlighting and Descending Date Columns

I want to create a Matrix visual with the max value in each row highlighted and descending date column. I can get each to function independently but not together. When I try to combine, every row is highlighted (see below)

 

dwelsh_0-1739540851697.png

 

The bottom matrix has rows Stores, columns Date Desc and value Sales.

Date Desc is a column equal to the Date column and is sorted by Date Ranked column:

Date Rank = rankx('Data', [Date])

 

Here is the Measure for my Highlighting:

MaxInRowDateDesc = 
VAR __MaxUnits = 
MAXX(
    ALLSELECTED( 'Data'[Date Desc] ),
    [Sales]
)
RETURN
IF( 
    [Sales] = __MaxUnits,
    "Yellow"
)

 

Here are the Cell Element Background color settings for the Sales column:

dwelsh_1-1739541520400.png

 

The settings are causing every value to be highlighted yellow. What is odd, is if I am sorting Date Desc by itself, the highest value in each row works correctly. It only turns every value yellow when Date Desc is sorted by Date Rank.

 

2025-02-14_08-13-19.gif

 

Is there something I am doing incorrectly or is this a PBI limitiation? Is there a different way to acheive this?

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @dwelsh 
Yes this is a known issue, sort column is a part of the dax query, sow when the formula ignoring the date column, it should ignore the sort column too.
Modify the formula of ranking to :

MaxInRowDateDesc = 
VAR __MaxUnits = 
MAXX(
    ALLSELECTED( 'Data'[Date Desc], 'Data'[Date rank] ),
    [Sales]
)
RETURN
IF( 
    [Sales] = __MaxUnits,
    "Yellow"
)

It should work.

For more details please refer to the linked video of Alberto Ferrari :

https://www.youtube.com/watch?v=XmGfXqWxOak

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi, @dwelsh 

 

I tried adding the index column in Power Query.

vzhangtinmsft_0-1739780159661.png

Table.Group(#"Sorted Rows", {"Store"}, {{"Index", each Table.AddIndexColumn(_,"Index",1,1), type table}})

vzhangtinmsft_1-1739780239994.pngvzhangtinmsft_2-1739780281549.png

Expand the results of the table:

vzhangtinmsft_3-1739780324231.png

Date Column sort by Index column.

Measure Color = Var _Max= MAXX(ALLEXCEPT(Data,Data[Store]),[Sales])
RETURN
IF([Sales]=_Max,"Yellow")

vzhangtinmsft_4-1739780435878.png

Is this the result you expected?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Ritaf1983
Super User
Super User

Hi @dwelsh 
Yes this is a known issue, sort column is a part of the dax query, sow when the formula ignoring the date column, it should ignore the sort column too.
Modify the formula of ranking to :

MaxInRowDateDesc = 
VAR __MaxUnits = 
MAXX(
    ALLSELECTED( 'Data'[Date Desc], 'Data'[Date rank] ),
    [Sales]
)
RETURN
IF( 
    [Sales] = __MaxUnits,
    "Yellow"
)

It should work.

For more details please refer to the linked video of Alberto Ferrari :

https://www.youtube.com/watch?v=XmGfXqWxOak

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Thank you! That did it and seems so obvious now.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors