Change colour palette with a parameter

Matt Francis asked on Twitter:

 

Great question. Here’s my best answer:

Leaving aside the question why you would want to do this it’s an interesting question. I initially duplicated the Profit measure and assigned each a separate colour palette. I figured that if I had a calculated field to switch to one of those it would work, but the calculated field, of course, uses its own colour palette and not the underlying measures.

This approach fails as the calculated field doesn't use it's own paletter
This approach fails as the calculated field doesn’t use it’s own paletter

So instead, I created a calculation that makes profit negative or positive depending on the parameter, and then choose a Custom Diverging palette with a central colour in it, centred on 0:

I used a diverging 3 colour paletter
I used a diverging 3 colour paletter

What do you think? Are there other answers?