How can I count the number of slices in a pie chart?
The sheet I'm working on has a slider and a couple of pie charts. When the user slides the slider, it changes the Dimension Limits on the first pie chart to "Show only values that accumulate to" n% of results, based on revenue, with n being the number specified by the slider. That part works perfectly.
On a second pie chart, I want to show exactly the same slices (but showing volume instead of revenue). A little research showed me the way to do this is to have a calculated dimension that's something like:
I don't think you can retrieve the number of chart elements (like pie slices) from within another chart object.
For special settings, you can maybe work with the aggr() function to rebuild the dimension limit of your first chart in the second (there will probably arise an issue from the fact that aggr() dimensions will be sorted by load order, and you can't force another sort order that you will need to sum up e.g. by largest values).
What you can try is using the same dimension and dimension limits as in your first chart, but use your original expression only for the dimension limit (that will use the first expression), i.e. hide it for presentation (and show a second expression to present your real data, e.g Volume).
Unfortunately, hiding an expression is not an option in a pie chart, but for example in a bar chart. So this method will only work for some chart types.
Alternatively, you can use a pareto select action to actually selecting the dimension values. Doing so will affect both charts.
Thanks swuehl, that helps by confirming that objects can't really reference each other and that I'm not missing something obvious. I'm not sure if PareTo will do the trick because I need it to just happen as soon as the user changes the slider and without clicking a button. (There again, I may be missing something obvious.)