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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.