<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - Average/sum of column gets thrown off by boolean values"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=112326#c3">Comment # 3</a>
              on <a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - Average/sum of column gets thrown off by boolean values"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=112326">bug 112326</a>
              from <span class="vcard"><a class="email" href="mailto:michaelviveros@gmail.com" title="Michael Viveros <michaelviveros@gmail.com>"> <span class="fn">Michael Viveros</span></a>
</span></b>
        <pre>(In reply to Michael Viveros from <a href="show_bug.cgi?id=112326#c0">comment #0</a>)
<span class="quote">> Description:
> I have a pivot table based off a table with 3 columns: Date, Value,
> Is_Weekday. Is_Weekday is a boolean column. Value is just an arbitrary
> number. The pivot table groups the data in rows by Date and separates it in
> columns by Is_Weekday and uses SUM(Value) as the value. When I take the
> average of the Is_Weekday column, instead of computing the average of all
> the Values, it considers the Is_Weekday value as a value as well so the
> average gets thrown off by 1 element.

> Ex. column has values 9, 2 for Is_Weekday = FALSE, SUM is 11 which is good
> but AVERAGE is 3.67 which is wrong, it should be 5.5.

> Steps to Reproduce:
> 1. Create a table with 3 columns: Date, Value, Is_Weekday. Assign arbitrary
> values to Value
> 2. Create a pivot table which groups the data in rows by Date and separates
> it in columns by Is_Weekday and uses SUM(Value) as the value
> 3. Compute the AVERAGE of the Is_Weekday = FALSE column (or the Is_Weekday =
> TRUE column) and see that it is off by 1 element

> Actual Results:  
> AVERAGE includes boolean value as an element, so instead of taking the SUM
> of X elements and dividing by X, it takes the SUM of X elements and divides
> by X + 1

> Expected Results:
> AVERAGE should include boolean value as an element, it should equal SUM of X
> elements divided by X


> Reproducible: Always

> User Profile Reset: No

> Additional Info:


> User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6)
> AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36</span >

(In reply to Michael Viveros from <a href="show_bug.cgi?id=112326#c2">comment #2</a>)
<span class="quote">> Minor mistake: labels in pivot table sheet for SUM/AVERAGE calculations
> (column E) should be flipped. SUM WEEKEND should be SUM WEEKDAY, AVERAGE
> WEEEKEND should be AVERAGE WEEKDAY, ...</span >

SUM gets thrown off too when boolean value = True. Ex. column has values 15, 1,
10, 3, 4 for Is_Weekday = TRUE, SUM = 34 but it should be 33. I can file
another bug for SUM being throw off too if necessary (I just changed the title
of this bug for now).</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>