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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
Saxon10
Post Prodigy
Post Prodigy

Conditional formatting for Variable

 

I have the following columns are Id, Code, Result1, Result2, Result1 colour code and Result colour code in data table.

 

For Result1 and Resul2 created slicer table for switch the Results in visual and the same way created measure for value columns in matrix table .

 

Data:

IDCodeResult1Result2Result colour codeResult2 colour code
1SAWinId1GreenGreen
1SAWinId1GreenGreen
1SBWinId1GreenGreen
1SCWinId1GreenGreen
1SDWinId1GreenGreen
1SDWinId1GreenGreen
2SALossId2RedRed
2SBLossId2RedRed
2SCLossId2RedRed
2SDLossId2RedRed
3SALossId3RedOrange
3SALossId3RedOrange
4SAWinId4GreenYellow
4SAWinId4GreenYellow
5SAWinId5GreenPurple
5SBWinId5GreenPurple
6SCLossId6RedBlue
6SDLossId6RedBlue

 

AlexisOlson helped for slicer and measure

 

Slicer = DATATABLE ( "Result", STRING, {{"Result 1"}, {"Result 2"}} )
 
VarResult =
SWITCH (
SELECTEDVALUE ( Slicer[Result] ),
"Result 1", SELECTEDVALUE ( REPORT[Result1] ),
"Result 2", SELECTEDVALUE ( REPORT[Result2] ),
SELECTEDVALUE ( REPORT[Result1] ) & "-" & SELECTEDVALUE ( REPORT[Result2] )
)

 

If I selected the Result1 status in slicer table then it will reflect Result1 status and row/columns only and the same thing for Result2.

 

Now my question is how can I apply the conditional according to the result.

 

Saxon10_0-1636497333452.png

Measure:

 

Saxon10_1-1636498081919.png

 

Slicer

Saxon10_2-1636498112065.png

 

PBI file attached.

https://www.dropbox.com/s/rpesne9daxq45j6/Materix%20multiple%20visual%20on%20value%20column.pbix?dl=...

 

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

Define a similar color measure.

VarColor = 
SWITCH (
    SELECTEDVALUE ( Slicer[Result] ),
    "Result 1", SELECTEDVALUE ( REPORT[Result colour code] ),
    "Result 2", SELECTEDVALUE ( REPORT[Result2 colour code] )
)

 

Then use that in the conditional formatting.

AlexisOlson_0-1636501524694.png

 

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

Define a similar color measure.

VarColor = 
SWITCH (
    SELECTEDVALUE ( Slicer[Result] ),
    "Result 1", SELECTEDVALUE ( REPORT[Result colour code] ),
    "Result 2", SELECTEDVALUE ( REPORT[Result2 colour code] )
)

 

Then use that in the conditional formatting.

AlexisOlson_0-1636501524694.png

 

Hi. Thanks for your reply and sorry for the late response.

Your solution is working well. 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.