I am trying to calculate per subset the average of a variable (ROI).
I need the ROI weighted by another variable (costs). I can set the weighting in the visuals which works fine, but can I integrate this weighting in the SUBSET_MEAN function?
Another idea - again, not yet available - is to have a SUM_FOR function (and MEAN_FOR) such as SUM_FOR(SUBSET(...), [A]*[B]) which would evaluate a sub-expression (e.g. [A]*[B]) and calculate it for every record in SUBSET(...), then take the sum of those results. This also would allow you to construct a weighted mean and other more complex formulae.
I have a very similar requirement like above. I need to weight SUBSET_MEAN of "Percent View" with a field called Total. Could you please suggest a workaround? Would multiplying the original column with the Total column and then applying SUBSET_MEAN work?
From bitter experience, I would advise extreme caution when using weighted mean calculations... they can work well in some cases, but results are dependent on underlying data, aggregation choices, use of subsets and grouping. It is very easy to derive incorrect results which look 'pretty close' in many cases but can be substantially wrong. I say bitter experience because I have been caught out several times in client projects, and now resist the use of weighted means in all commercial work. For an example, see this thread - http://forums.visokio.com/comments.php?DiscussionID=437