The users of my report are getting confused, because when using slicers the visual conditional formatting is changing.
I have a table visual with the following conditional formatting:
This CF is applied to this visual (edit: pls keep in mind that it bugged and on the screenshot lowest and highest colors are reverted - lowest should be red and highest - green):
When I select Mexico (rank 1), I want to see it colored in green (as it is when no selections are made). In fact, it is showing up in red:
I understand that it is showing wrong color because we only have 1 value, because Mexico value is minimum and maximum in that case (although I can't quite grasp why it shows exactly red).
The goal is that this color stays always the same, based on all subgroups, regardless of the selections in the slicer. Something like how the ranking number stays the same, no matter how many subgroups I have selected - Canada Rank 2, China Rank 5:







I found an acceptable workaround for this. I used a website to generate gradient from green to red. The site is this. It gave me the opportunity to enter a step number (it will get from green to red in a certain number of steps).
I then created the following measure:
This code provides a color from red to green for each value, based on these brackets. I decided for 6, because that is the number of subgroups that I have in my data, but the number of bracket can be more or less. And this is the final result. The gradient:
Conditional formatting is kept, because there is already a predefined color:
Probably a downside to this approach is that I could not find a site that allows adding also a middle color to this path, but this works fine.