The only way I am aware to do this is by using the Dimension Limit functionality. Since the # can be an expression you may be able to use some conditional logic to compute this. If there is more info I find for you, I will update this discussion.
Thanks for your inquiry and being a Qlik Community member.
Here is a brief video on the topic:
Let me know if this helps.
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others.