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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.