3 Replies Latest reply on Apr 19, 2016 5:58 AM by Adam Crahen

# Can you create a group in an aggregated measure?

I am trying to create a bar chart that shows both a SUM point for an individual products price and and the AVG price for all the selected products!  I have created a simplified worksheet to show my problem.

Tableau is automatically aggregating all the selected data as it does by default, this isn't giving me my desired results for the bars in my chart as it is aggregating both the totals for the Pineapples and Bananas. However what I would like it to do is to sum Bananas and Pineapples separately for each year and then get an average of the sum totals of the products.

Is it possible to create a group for each product  to do this or does anyone know of a better method ?

P.S for some other reason it does not allow me to synchronize the axi..

• ###### 1. Re: Can you create a group in an aggregated measure?

Hi Conor-

You can't sync the axes because your selling price is a whole number (INT) and you AVG aggregation is creating a decimal (Float).  Change selling price to decimal and this will work.

When you stack the bars like that it could be confusing to the reader as the the avg. selling price for bananas is 4.5, but the bar is at 10 on the axis.

Use this LOD calc for the annual average:

{fixed [Year] : avg([Selling Price])}

I would turn year to discrete.  Replace your average calc with the one above.  Sync the axis.  Change the average bar to gray or something and use the fruit color on circle.  Then you can hide one of those axes or both and label everything.

9.1. attached

• ###### 2. Re: Can you create a group in an aggregated measure?

thanks for the reply and explaining the sync of the axis.

I don't think I explained my issue well enough. What I am looking for is the bar to be the average of the selling price points for each year.

E.g The bar in 2000 should be at 13 as that would be the average of those two points.

This is a very simplified worksheet to the one I am working on, but the idea is roughly the same.

• ###### 3. Re: Can you create a group in an aggregated measure?

Try this:

{fixed [Year], [Fruit Type] : SUM([Selling Price])/COUNTD([Fruit Type])}

2 of 2 people found this helpful