I have a client dashboard where I show some charts and tables and these are filtered on advertiser level (single select filter). Currently I am using the same set of colors for all advertisers across all the charts.
Now, the requirement is to change these chart colors dynamically based on the selected advertiser. For testing purposes I am implementing in the following manner (for a chart which contains both negative and positive values):
1. Create a calculated which looks for advertiser value and the metric value (being displayed in chart) using IF conditions.
2. For advertiser: abc and metric value <0 assign a unique identifier like abc_negative.
For advertiser: abc and metric value >=0 assign a unique identifier like abc_positive.
3. Write similar IF conditions for rest of the advertisers. Once this step is done, drag and drop this calculated field in the color mark and one by one select an advertiser and manually assign both the negative and positive color hex values for them.
4. Repeat this process for all the advertisers one by one.
I have tested this calculated field solution for a limited number of advertisers and it is working fine. But the main problem is that this process is entirely manual and is not scalable as the number of advertisers will keep on increasing in the future. Also, if I have to change a color even for one of the existing advertisers, I will need to manually make this change in desktop and then re-publish the dashboard.
To resolve this, I am planning to create a mapping table which contains all the advertiser ids and their respective 2 or 3 colors and then use this table to assign the colors in tableau's color shelf. But over here as well I need to manually select the color values for every advertiser one by one even though the mapping table consists of all the hex codes properly.
1. Is there a way to make the color shelf in tableau desktop automatically pick all the colors based on the selected advertiser?
2. Also lets say I change colors for an existing advertiser in the mapping table, is it possible that the published dashboard automatically picks the new colors without the need of republishing?
3. Similarly, if I add a new advertiser and it's respective colors in the mapping table, is it possible for the dashboard to automatically pick up these colors in all the charts present?
I am trying various things like:
1. Use a advertiser to color mapping table. This solution will not require a huge calculated field but still I would need to manually assign colors in the color shelf.
2. Same goes with other kinds of data sources like excel sheet, google sheet, etc.
3. I tried to explore REST API functionality as well but I am not able to understand how to automatically change the color in the charts based on the hex codes passed by REST API. I can pass the hex code values but since color shelf is internal to the dashboard, ! am not able to dynamically change charts' colors.
4. Same thing goes with Web Data Connector functionality.
Is it possible to implement this requirement?
It would be great if anyone could help me with this.