1 of 1 people found this helpful
Sets seems not good for your specific case.
Just try using a rank filter. Create a calc field [Rank] and drag it to filter shelf. Select True.
We can get this via index and top 10.
By using Index( ) in calculated filed and drag that calculated field in rows shelf we can achieve this.Please find the attached twbx.I hope this solves your problem
Step1: Create calc field called index ie index( )
Step2: Drag the customer name and calc field index into row shelf.
Right click customer name descending and sort via field [sales]
Step3: create [Top N] parameter with integer data type
Step 4:Create calc field called top10? Title Top 10 calculations – Top10?
if [Index]<=[Top N] THEN "Top N" ELSE IF [Index]>=SIZE()-[Top N]
THEN "Bottom n" else “Others” end end
Drag calculation field Top 10? Into filter then select top n and bottom n.
Drag the new calculation into row.
show parameter control and type 10,20 etc
Thank you ! The problem is I need to get ALL OTHER bucket after the INDEX() – ☹ Can’t seem to figure that one out!
Create [Head and Tail] filter as:
if Rank(sum([Sales]))<=10 then 'Top 10"
You can always replace Top 10 by a parameter [Top N].
Thanks Alexander – the calculated field goes to Measures not Dimensions – how can I make it list what the TOP 10 and OTHERS – so my bar chart would have 11 BARS on it?
Thanks a lot!
Try this then, a technique by Joe Mako
I also wrote a piece based on % instead of rank. Technique is similar.
Does being measure or dimension matter in your case?
Yes – because I ultimately need a chart by each BRAND+ SUM of ALL OTHER – so 11 bars. Thanks ☺
I am attaching a packaged workbook after I tried to reproduce Joe Mako - Top N Parameters - but can't seem to make it work like on his file.
Any help is appreciated!
What are your desired results for the view? Can you provide a visual mockup of what you hope to achieve here? Cheers!
I'm confused because INDEX is the only measure in play in the sample TWBX I opened -- are you wanting to plot SUM(Sales) for the Top 10 and Others, or something else?
Yes - that's exactly what I'm trying to do - I've tried lots of different ways and posted the last TWBX which I was trying to mirror Joe M file posted by Alexander above as an option to achieve what I was looking for. Because I have different Geographies, Time frames, etc - the option to use Tableau TOP N (set) did not work as it seems that it looks at all data not only what I am filtering by in each view.
I think I tried everything recommended above but nothing seems to calculate correctly top N (based on parameter) + Other.
The view I just posted is from a previous version where I almost got it to work however The top 10 brands being marked as top 10 were not correct - therefore I think it was ignoring the Geography and Timeframes chosen and just reporting on top 10 for all data.
See attached - I can clearly see that Palmers and Curel are larger than Cetaphil - yet it is marking it as other and leaving Cetaphil in the Top 10.
DATA for Chart.PNG 46.8 KB