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

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

Reply
AndreeaV
Advocate I
Advocate I

How to change the color of a value resulting from a selection in a field parameter?

Hi.

The slicer is a field parameter.

In the slicer, I select something, and the value is shown in the lower part of the KPI. I would like to change the color of the selected value (now 12.97%) to green if it's >0 and red if it is <0.

How can I do that? I used SELECTEDVALUE and SWITCH TRUE () and it didn't work.

Thanks!

 

 

Screenshot 2023-08-10 205155.png

1 ACCEPTED SOLUTION
AmiraBedh
Super User
Super User

You will need to create a measure that calculates the value you want to display. This measure should evaluate to the percentage you mentioned.

SelectedValueMeasure =

IF(
SELECTEDVALUE(YourTable[YourColumn]) > 0,
[YourPositiveMeasure],
[YourNegativeMeasure]
)

You'll then want to create a KPI or Card visual using this measure.

To apply the color formatting based on the value, you will need to do the following:

- Click on the KPI or Card visual that you want to format.
- Go to the "Format" pane.
- Click on "Conditional formatting."
- Select the option to format, such as "Data labels" or "Font color."
- Choose "Format by field value" and select the measure you created.
- Set the rules for the formatting, such as green for values greater than 0 and red for values less than 0.

 


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

View solution in original post

5 REPLIES 5
parry2k
Super User
Super User

@AndreeaV I understood what you are trying to achieve and the selectedvalue function in this case will not work. This is a shortcoming in field parameters when you want to get the measure value based on the selected field parameter but there is a workaround that basically makes field parameters useless (in this example).

 

👉 Learn Power BI and Fabric - subscribe to our YT channel - @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤️

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

AndreeaV
Advocate I
Advocate I

The labels (e.g. "Yearly price change MSFT") in the field parameter slicer are measures. I tried SELECTEDVALUE and it doesn't seem to work with parameters, because it treats the selected values as text.

In Power BI, slicers don't directly interact with measures, as slicers typically filter data based on a column in a table, while measures perform calculations on that data.

If you have a measure like "Yearly price change MSFT" that you want to control via a slicer, you may need to rethink your approach. Here's one way you might accomplish this:

 


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

Can you please share your pbix file ?


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696
AmiraBedh
Super User
Super User

You will need to create a measure that calculates the value you want to display. This measure should evaluate to the percentage you mentioned.

SelectedValueMeasure =

IF(
SELECTEDVALUE(YourTable[YourColumn]) > 0,
[YourPositiveMeasure],
[YourNegativeMeasure]
)

You'll then want to create a KPI or Card visual using this measure.

To apply the color formatting based on the value, you will need to do the following:

- Click on the KPI or Card visual that you want to format.
- Go to the "Format" pane.
- Click on "Conditional formatting."
- Select the option to format, such as "Data labels" or "Font color."
- Choose "Format by field value" and select the measure you created.
- Set the rules for the formatting, such as green for values greater than 0 and red for values less than 0.

 


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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