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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
learner03
Post Partisan
Post Partisan

Conditional highlight on max in matrix

How can I do conditional highlight based on each row by product in this situation like, if Max quantity in the row in destination belongs to same state and max quantity belong to state in origin then do not highlight otherwise highlight both max in both (destintion & origin)

example-  max of product A is 1000 which belongs to y1 and max in origin is 1000which belongs to y1 so no highlight. Same for product B.

But for product C, Max in the destination is 1000 which belongs to x1 and max in origin is 1000 that belongs to Z1, so highlight both values here. 

In G, Max in destination  belongs to z1 which is 300 and max in origin belongs to y1 which is 343, so highlight both.

 

akapoor03_0-1705449262155.png

 

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file whether it suits your requirement.

 

Jihwan_Kim_1-1705465217251.png

 

Jihwan_Kim_0-1705465200988.png

 

INDEX function (DAX) - DAX | Microsoft Learn

 

color condition: =
VAR _destinationmaxstate =
    MAXX (
        INDEX (
            1,
            FILTER ( ALL ( State ), State[State Type] = "Destination" ),
            ORDERBY ( [Quantity:], DESC )
        ),
        State[State]
    )
VAR _originnmaxstate =
    MAXX (
        INDEX (
            1,
            FILTER ( ALL ( State ), State[State Type] = "Origin" ),
            ORDERBY ( [Quantity:], DESC )
        ),
        State[State]
    )
VAR _maxqty =
    CALCULATE (
        [Quantity:],
        INDEX (
            1,
            ALL ( State ),
            ORDERBY ( [Quantity:], DESC ),
            ,
            PARTITIONBY ( State[State Type] )
        )
    )
RETURN
    IF ( _destinationmaxstate <> _originnmaxstate && [Quantity:] = _maxqty, "red" )

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


@Jihwan_Kim it says "INDEX's Relation parameter may have duplicate rows. This is not allowed.".

my Model is below and I have pivotted state column.

Input

ProdInvc    
     
P.Name

Origin State

Destination StateQtyAmount
Ax1z120200
by1w11001000
cz1x110002000
ew1y13002000
fx1z12003000
gy1w143200
hz1x12001000
iw1y14004000
jx1z14005000
ky1z13002000
lz1w12003000
mw1x11001000
Ay1y110001000
bz1z13002000
cw1w12002000
ex1x1433000
fy1y11000200
gy1z13001000
hz1w12004000
iw1x1431000
jx1y12002000
ky1z1432000
ly1w12003000
mz1x1400200
cw1y14001000
ex1z13004000
fy1w12002000

 

State
x1
y1
z1
w1
 

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.