8 Replies Latest reply on Jan 10, 2019 5:52 AM by Christian Setzkorn

# Mean/Averages not calculated correctly

My data is as follows:

 User Combination Value Cat X MO1 C1 10 a 1 MO1 C1 12 a 1 MO2 C1 5 a 2 MO2 C1 7 a 2 MO2 C1 13 a 2 MO3 C1 20 a 3 MO1 C2 10 a 1 MO1 C2 12 a 1 MO1 C2 12 a 1 MO3 C2 20 a 3 MO3 C2 20 a 3 MO3 C2 20 a 3 MO3 C2 20 a 3 _target C1 10 b 4 _target C2 13 b 4

My current solution is also attached and this is a screenshot:

The blue line should be the mean of the value column of category (Cat column) = a and the red line the mean of the value column of category (Cat column) = b depending on the choice of Combination (either C1 or C2). This seem to work fine for Cat=b but not Cat=a.

The expected values should be:

Choice C1 => 11.16666667

Choice C2 => 16.28571429

rather than:

Choice C1 => 13.11

Choice C2 => 15.667

Can anyone see something wrong please? Thanks.

• ###### 1. Re: Mean/Averages not calculated correctly

Hi, Christian

Hope this helps

ZZ

• ###### 2. Re: Mean/Averages not calculated correctly

Thanks. If I implement this:

{ FIXED: AVG(IF [Cat] == 'a' THEN [Value] END) }

I get a constant value of 13.92 even when I change the filter for Combination. Can you please add your attachment? Thanks.

• ###### 3. Re: Mean/Averages not calculated correctly

Hi, Christian

one thing I forgot to mention is, you need right click your filter and select add to context so that the reference line value will change according to your selection.

ZZ

• ###### 4. Re: Mean/Averages not calculated correctly

Thanks! Excellent!

• ###### 5. Re: Mean/Averages not calculated correctly

No worries, I am glad to help

ZZ

• ###### 6. Re: Mean/Averages not calculated correctly

I am sorry one more thing. I used the mean (AVG) can this also be done for the median? Thanks! Happy to create another question and accept the current answer.

• ###### 7. Re: Mean/Averages not calculated correctly

Yes, just replace the avg with median in the calculation

ZZ

• ###### 8. Re: Mean/Averages not calculated correctly

Sorry my bad. In the actual solution I had to create an extract before the Median was known (-: