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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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