简体   繁体   中英

Top N by Count of Dimension Tableau

I am a bit new to Tableau.

I have two columns: DATE and Car Model

I want to create bar graphs for the Top 5 (Count of Car Model) each individual year on the same sheet.

When I select the Top N filter, it selects the overall top 5 models and displays counts for each such model.

However, each year has a different Top 5. I want to be able to get the top for that particular year only.

Can anyone help me with it?

在此处输入图像描述

在此处输入图像描述

This you can do through function INDEX . Do these steps (I am replicating your problem on sample superstore as you haven't given any data)

  • I built a view/viz with order date & customer name rows shelf and sum(sales) on columns shelf.

  • create a calculated field named say INDEX with formula INDEX()

  • drag this INDEx field to DETAILS on Marks card

  • right click, edit table calculation and set the following options -- specific dimensions (check both fields drag to adjust date field prior to second nested field) -- At the level (select second field name - customer name in my case) -- restarting at every (select first date field, order date in my case) -- sort order - CUSTOM - select Sales(Measure) with descending and aggregation as your measure (sum in my case). A screenshot is attached for reference

在此处输入图像描述

  • ctrl + drag INDEX field to Filter and select 1 to 5 .

  • Your desired view is ready

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM