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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Keshavpooja
Frequent Visitor

Conditional Formatting based on rules with dynamic conditions from slicer selection

Hi Experts,

 

I have a conditional formatting set in a Matrix based on rules which checks for the values in certain range and display traffic light icons accordingly. The screenshot is atttached below.

 

Keshavpooja_0-1643579748644.png

Now I would need to change this logic of threshold check based on slicer selection. For instance, when the user selects Market=A, the above threshold shown in the image should work i.e. Red Light=0-0.5, Yellow Light=0.5-0.9, Green Light=0.9-1. When the user selects Market=B, the threshold check should be Red=0-0.7, Yellow=0.7-0.8, Green=0.8-1

 

Could you pls guide me with this approach 

 

Mvh,

Kesavan.

5 REPLIES 5
parry2k
Super User
Super User

@Keshavpooja Although @negi007 has provided the solution if tomorrow there is another change, you have to come and update the measure and I always think of the solution from the scalability point of view. Check my video on conditional formatting where you store the data in an external source and any future change can be easily made without making the changes in the model. https://youtu.be/s3riB6EtqkY

 

Just my 2 cents.

 

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



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.

parry2k
Super User
Super User

@Keshavpooja where is the logic for each customer that drives the range? Do you have it in a table somewhere?



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.

Hi,

 

As shown in the image, the threshold value ranges are directly used in the Rules and not stored anywhere in table. Until now all the Markets have been following the same threshold but now one of the Markets is going to follow a different threshold which i am not sure how to implement.

@Keshavpooja in this case, i suggest you to create a calc column like below there you can define sepeate condition for market A and Other markets.

 

So you can code color green with 1 and yellow with 2 and red with 3 like below

 

Color_coding =
var _sla_va = 'Table'[SLA Fullment]
return
if ('Table'[Market] = "A" ,
SWITCH(TRUE(),
_sla_va>=0.9,1,
_sla_va>=0.5,2,
_sla_va>=0,3
),
SWITCH(TRUE(),
_sla_va>=0.8,1,
_sla_va>=0.7,2,
_sla_va>=0,3
)
)
 
then in the conditional formatting of your matrix you can put condition like below
 
negi007_0-1643614297064.png

 

below is the final output

 

negi007_1-1643614336594.png

 

i have attached the pbix file for your reference as well. 

 

 




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

Hi @negi007 ,

 

Thanks a lot for your quick help with a solution. I had a look at your pbix file.

 

In my case the market field is not available in the same table on which matrix is built on. Hence i could not build Calc.Column. The market field is coming from another table and there is a slicer on Market where the user selects the market and runs the report. In such case, how can we capture the market selected by the user inside the calculation logic that you have provided.

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Solution Authors
Top Kudoed Authors