KNOWLEDGE BASE

## How to Create Bar Graph of Sales Divided by Uneven Groups Based On Rank

Published: 19 Sep 2023

### Question

How to create a bar graph of sales divided by uneven groups based on rank ### Environment

• Tableau Desktop

Follow along with the sample packaged workbook found in the Attachments section of this article while viewing these steps:

1. Create the following calculated field:

RANK:
RANK(SUM([Sales]))

Top5:
WINDOW_SUM(
IF [RANK]<=5 THEN SUM([Sales]) END
)

Top10:
WINDOW_SUM(
IF [RANK]<=10 AND [RANK]>5 THEN SUM([Sales]) END
)

Top50:
WINDOW_SUM(
IF [RANK]<=50 AND [RANK]>10 THEN SUM([Sales]) END
)

Top100:
WINDOW_SUM(
IF [RANK]<=100 AND [RANK]>50 THEN SUM([Sales]) END
)

Over100:
WINDOW_SUM(
IF [RANK]>100 THEN SUM([Sales]) END
)

2. Drag [Customer Name] to [Detail]

3. Drag [Measure Names] to [Filters] and select Top5 / Top10 / Top50 / Top100 / Over100

4. Drag [Measure Names] to [Rows]

5. Drag [Measure Value] to [Columns]

6. In [Measure Value] card, sort measures manually

7. In [Measure Value] card, right-click on each measure and select Computing Using > Customer Name

8. Select Analysis > Stack Marks > Off

9. Right-click on label of each measure and select Edit Alias..., remove 'along Customer Name'

10. Select Tooltip and input the following:

Sum of Sales from <Measure Names> Customers: <Measure Values>

11. Right-click on Value axis and select Edit Axis..., change Title to Sales