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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

How to use switch function to change to value in another column for conditional formatting

I am trying to conditional format my column chart based on the status of the columns. I have data that is coming in for the status as colours (red, green, yellow). I am trying to use the switch function to switch the columns to thier respective status colour.
 This is a sample of the data set. 
StaffPTCarStaff StatusPT StatusCar Status
463YellowGreenRed

 

What I have done is pull that data in and filter by max date so it only shows me the data for the latest. Then I use the switch function to display the number for each column. (as a column chart) which works even though of the sum aggregation because it is filter to only one row of data.

 

Measure Value =
SWITCH(
SELECTEDVALUE('Measure'[Measure]),
"Staff",SUM(response[Total Staff]),
"PT",SUM(response[Total PT]),
"Car",SUM(response[Total Car]),
)
This is the dax measure that i am using which does not work.
Measure Colour =
SWITCH(
SELECTEDVALUE('Measure'[Measure]),
"Staff",MIN(response[Staff Status]),
"PT",MIN(response[PT Status]),
"Car",MIN(response[Car Status]),
)
 
I have tried all the aggregate functions (sum, average, min, max)
1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , Measure Colour seems fine. Hope you using it in conditional formatting using field value

 

You can also try default a value

 

SELECTEDVALUE('Measure'[Measure], "Staff")

 

in both measures

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors