Interesting challenge! I don't think you can mix both conditions (Top N & Groups) in the same calculated field because you can potentially have customers that fit on both sides, thus generating incorrect results if you only select one option.
That said, you may be able to do achieve something similar using a parameter and a couple of calculated fields:
1. First, create a parameter that lets the user pick between seeing results by 'Customer Group' or by 'Top Customers'. Let's call it [See by:]
2. Create a dynamic set of Top N customers. Let's call it [Top Customers by Profit]
3. Create a calculated field that will display either a [Customer Name] or a [Customer Group] based on the parameter selection. Let's call it [Selected Option], we'll place this on Rows.
4. Finally, let's create another calculated field that we'll use as a filter. This will limit results to Top N customers only when the parameter is selected to show 'Top Customers'. Let's call it [Selected Filter], drag to filters and set it to TRUE only.
A working example is attached. You can potentially add another filter for [Customer Group] but then the user will have to make 2 selections.
Hope this helps!
GroupOrTop.twbx 143.0 KB
Thanks for your feedback. I went with a two parameter approach one as you said is a group of the Top-N.
Wishing you all the best
Glad to hear it worked, Hiten! All the best to you too.