One thing that might work here would be to create an index() calculation off the level you want to colour, and then use the Index as the colour.
Take a look at the attached (where I've created a separate sheet to act as the legend), and see if that might do the trick.
Hopefully you can see how I've done it, but let me know if anything doesn't make sense.
Dynamic Colouring on Selection.twbx 1,008.1 KB
Thank you, Simon!
I'm afraid the workbook doesn't seem to be downloading correctly. Could you possibly upload another version?
I'm using version 10.2.0.
Thanks a lot!
Stephanie and I are collaborating on this Tableau Project.
Thank you very much for your detailed help. The dynamical adjustment of the colors is working now.
However, another problem occurred:
Whenever I filter the Data the sorting order changes.
Is there a way to include a sorting order (Highest Number of Accounts to lowest Number of Accounts) which affects also the Legend Sheet? This Sorting order should be based on the filtered view. (e.g. sorting on index())
Thanks a lot for your help!
The Index() calculation just numbers things in order, so in my example as there was no sort everything was alphabetic and so remained consistent between the 2 sheets (as the City filter is shared). We can do this equally, but sorting the category on something
In the attached sorted the Category in both sheets on Sales, and they now retain the colour on the sort
Hope that helps.
thanks a lot for the quick response.
I already tried it this way. In my Case the field is Bank Accounts and the Aggregation is Count.
However it is not sorted correctly.
Is there a way to sort based on Index()? E.g. the highest Index on top - lowest on bottom?
So yes you can create a sort within an index()
However if I want something sorted, I generally opt for the RANK functions....which have (of course) sort built in. For this situation you'll want RANK_UNIQUE (else if 2 Bank Accounts have the same count, they'll get the same RANK and thus colour)