Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in BI by (17.6k points)

I am using Tableau Desktop 8.1

I have a Tableau workbook with data at 3 hierarchical levels: Region, State, and County. I have 2 fields: Product, Price, and Quantity Sold.

I need Tableau to calculate the weighted average of Product Price by "Quantity Sold" at each hierarchical level.

For example :

At the smallest level (County) the Product Price should not change. The price in that county is the price in that county. However, when County is minimized and the data is rolled up to the Region->State level, I want Tableau to show the weighted average Product Price (weighted by quantity sold) for all of the counties in each state, rather than the summation of the product price for all counties in that state.

In Excel I would use a sumproduct, but have been unable to find an answer in Tableau.

1 Answer

0 votes
by (22.5k points)
  1. Create a calculated field
  2. set formula
  3. The general formula for weighted average would be

SUM (Weight * Value) / SUM (Weight)

    4.Then click ok

Are you a newbie to tableau , then check tableau tutorial provided by intellipaat

You can enroll in this Best Tableau Desktop Specialist Certification course online by Intellipaat to learn basic and advanced Tableau.

Related questions

Browse Categories

...