6 Replies Latest reply on Aug 20, 2016 9:54 PM by anil kumar

# Top N and Others Pie Chart

Hi All,

I am trying achieve top N and others using a pie charts, tried various methods

but stuck with some limitations like unable to use filters for top n and others pie chart.

When using filters the top N is not showing correctly.

I have attached workbook, please look into it and help me out.

Thank you,

Regards, Anil.

• ###### 1. Re: Top N and Others Pie Chart

Friends, anyone with solution?

• ###### 2. Re: Top N and Others Pie Chart

hi Anil,

So here you go...so what I did here was to use sets (which it looks like you'd already investigated!)...

So I create a set off Product Name, returning the Top N (on Sum of Sale). As you want to see the Top N induvidually, I created the following calculation to use as the dimension in the Pie

[Pie Chart DIM]

IF [Top N Products] THEN [Product Name] ELSE 'Others' END

I also created a sort field, so they would go largest to smallest

[Pie Chart DIM Sorter]

IF [Top N Products] THEN [Sales] ELSE 0 END

and I sort on this field.

Now for the filter...As sets are calculated before dimension filters are applied, just having a regular filter wouldn't change the members of the sets. However we can 'bump' the filter up the calculation pipeline by making it a 'context' filter (in the filter option, click 'add to context' and it will be gray to know it's a context filter. There is a (potential) performance cost to using context filters, but unless your data is really large/complicated you'll barely notice.

Hope this does the trick, and makes sense, but if not please post back.

• ###### 3. Re: Top N and Others Pie Chart

Hi Simon,

Thanks for the replay, will check you .twbx and revert back.

Regards, Anil

• ###### 4. Re: Top N and Others Pie Chart

Hi Simon,

You have used Category as filter which has non dependent fields,

I have filtered using Region the sort order is not uniform. Try changing Region filter and Top N Parameter.Please check attached file.

• ###### 5. Re: Top N and Others Pie Chart

So it doesn't matter which dimension we use as a filter, the key is that it needs to be a Context level (or higher) filter

As it is only by adding the filter to context, that it will take affect before the Top N set is calculated.

In the attached I've added it to context, and is now doing what we want.

• ###### 6. Re: Top N and Others Pie Chart

Thank you Simon that works like charm .

Regards, Anil.