Note that I had also removed the sumOver from the calculation, as otherwise I would have received the same aggregated value for all of my customers within the same Industry+Product combination - which is usually not what you want when trying to rank to find the Top N entries. If your use case is different, please don’t hesitate to share it with us.
Did this answer your question? If so, please help the community out by marking this answer as "Solution!
but it doesn’t seem to work for my visualization. I’m trying to create a new field which returns the ‘name_detail’ (if less/equals than top), else ‘Others’. Then use the new field in donut chart below (replace name_detail), so that when users adjust the ‘Top’ Filter, the chart will also change to display the name of the Top N products only (otherwise, product name will be ‘Others’)
As custom aggregation fields are currently not supported as a dimension, the approach mentioned above does not work with that chart type. To still get a dynamic filter for top N elements in that visual, you could implement a simple rank field and then use that to filter out all items that don’t fall within the top N elements. You would then only miss a direct indication of how much went into the “Other” category.
Depending on your datasource, you might also be able to leverage a dataset parameter in combination with a custom SQL query (see example) and add the “top X elements” logic into that query instead. This would allow you to still get all rows that sit outside the top elements grouped into an “Others” bucket.
Did this answer your question? If so, please help the community out by marking this answer as "Solution!