3 Replies Latest reply on Aug 16, 2018 12:23 AM by Lotte Van Doorss

# Turnover calculation via sumproduct?

Hello,

I'm trying to calculate turnover. A simple table to explain is found below.

I have Price and I have Volume.

Price is already a calculation of 3 fields (Formula: zn(Field1)+zn(Field2)+zn(Field3)).

When I calculate turnover, I have to take sum(Price)*sum(Volume) or it gives me an aggregate error ("cannot mix aggr and non-aggr...").

If I keep article level in my table, it's not problem. But when I take it out, it calculates it as (2.8+2.1+104)*(400+900+20), which gives 535.788.

In Excel I would use a sumproduct, but I don't know how to fix this in Tableau?

 Article Price Volume Turnover A 2,8 4.000 11.200 B 2,1 900 1.890 C 104 20 2.080 15.170

Many thanks!

Kr,

Lotte

• ###### 1. Re: Turnover calculation via sumproduct?

Hi Lotte,

Try this

Price * Sum*(Volume)

It will give the correct value if i am right Price is already aggregated value and Volume is the direct field that's why you are getting the aggregate and non aggregate error,

if price is not aggregated, volume is aggregated then change the calc like below

Sum(Price)*Volume

Hope this helps kindly mark this answer as correct/helpful so that it will help others

BR,

NB

• ###### 2. Re: Turnover calculation via sumproduct?

Lotte,

Are you not able to do this:

sum(Price*Volume) ?

Thanks,

Ankit Bansal

• ###### 3. Re: Turnover calculation via sumproduct?

I am not able to do sum(Price*Volume) nor Price * Sum*(Volume) nor Sum(Price)*Volume, all these options result in the error that it cannot mix aggregate and non-aggregate...

The prices come from a different excel source that is blended with the volume data source, if that has anything to do with it?