KNOWLEDGE BASE

Output Only Regions with N or More Sales of a Specific Product


Published: 11 Jul 2022
Last Modified Date: 20 Jul 2022

Question

How to output only those regions with N or more sales of a specific product.

Example:
You want to output only records for regions where "A" has Sales of 30 or more.
User-added image

Environment

  • Tableau Desktop

Answer

The following procedure uses the sample Superstore data.

In the calculation below, only records for regions with a quantity of sales of 200 or more will be selected.

1. Open Tableau Desktop and connect to the Sample-Superstore saved data source.
2. Drag Category to the Columns shelf and State to the Rows shelf.
3. Select Analysis > Create Calculated Field.
4. In the Calculation editor that opens perform the following:
  • Name the calculation, Qty of Furniture.
  • Enter the following expression:
      {FIXED [State] : SUM(IF [Category] = "Furniture" THEN [Quantity] END)}

5. When finished, click OK.

6. Select Analysis > Create Calculated Field to create a second calculation.
7. In the Calculation editor, perform the following:
  • Name the calculation, Quantity Limit.
  • Enter the following expression:
               IF [Qty of Furniture] >= 200
               THEN TRUE
               ELSE FALSE
                END
8. When finished, click OK.
9. Drag Quantity Limit to the Filters shelf
10. In the Filter dialog box, check True and click OK  
User-added image
Did this article resolve the issue?