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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Colour coded card based on the filter clicked

Hi,

 

My problem here is i want to set the colour to my card based on the sales target of business unit. 

 

For example:

BU     | Sales Target

A       | 100

B       | 150

 

My card here shows the Sales number by whole at default. If i clicked the filter BU A, if the Sales number is higher than the target (100), the colour will be green, same as BU B. If lower than the colour is red.

 

If the filter is "all", the colour should be green if both A AND B passed the target. But the colour should be red if any A OR B below the target.

 

I have tried a few ways with SELECTEDVALUE and SWITCH functions but this one is out of my reach. Can anyone assist me on this matter?

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , Based on what I got.

If sales and target are measure or create measures

 

then you can have color measure

color = if([sales]>[Target], "Green", "Red")

 

You can use the above measure in conditional formatting using the field value option

 

How to do conditional formatting by measure and apply it on pie?
https://www.youtube.com/watch?v=RqBb5eBf_I4&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L
https://community.powerbi.com/t5/Community-Blog/Power-BI-Conditional-formatting-the-Pie-Visual/ba-p/1682539
https://amitchandak.medium.com/power-bi-where-is-the-conditional-formatting-option-in-new-format-pane-66e0afcb15f3

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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