Forum Discussion
TopN ties: handling ties when using visual level filters
The best way I've found to handle this is to create another version of your metric that eliminates ties by including small fractions. You can use this new column in the Top N filter to successfully limit to Top 5 even if there are ties, but the values displayed in the visual will not change.
Step 1) Create a custom column that replicates your metric formula. Add to your formula an ID or Index column (any column that has a unique numeric value per each item that you are ranking) multiplied by a small number such as .000000000000001. This will cause it to break ties successfully but will not change the ranking. Make sure the fraction multiplied is small enough that it does not change the aggregate numbers when summed up in the visualization. If there are specific requirements around how ties should be broken, you could add logic to this formula to do it accordinly. Multiplying by an ID or index value will probably break the tie arbitrarily (which seems fine for this use case).
New Column For Ranking = Original metric + (IDField *.000000000000001)
In OP's example:
CountofAlertsByAppForRanking = COUNT(mc_alerts[mc_alertid]) + (mc_applications[mc_applicationid] * .000000000000001)
Step 2) Add the new custom column to the "by value" area in the Top N filter.
The chart should appear exactly the same except it will be cut off at the Top N number rather than displaying multiple rows in the case of ties. It should also handle drill-down just fine.
This is a really clever solution -- thank you for sharing!