I am applying a weighted average to some dummy Box Office Data. I created a calculated value for the weighted average using the box office. It works when all the rows are populated with data.
The first column is if I applied a weighted average via the box office gross (ie. a movie with more sales should factor more into average).
The second column is a standard tableau calculation, taking the average of the values.
The problem is, when there are nulls for the demographic, the corresponding movie's box office is still being added to the total.
I did the math in Excel to double check my numbers.
So what I am trying to do is calculate the weighted average, with a box office total of the films that have the relevant demographic info, the last row of my excel screenshot. Any ideas?
You can create the calculated field listed below to achieve your desired results.
SUM([Domestic Box Office]*[Age 10<])
SUM(IF [Age 10<]>0
THEN [Domestic Box Office]
I hope this helps. Please remember to mark the question answered if this does answer your question.
Thanks and best,