[Libreoffice-bugs] [Bug 112326] Average/sum of column gets thrown off by boolean values

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Mon Sep 11 13:20:53 UTC 2017


https://bugs.documentfoundation.org/show_bug.cgi?id=112326

--- Comment #3 from Michael Viveros <michaelviveros at gmail.com> ---
(In reply to Michael Viveros from comment #0)
> 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

(In reply to Michael Viveros from comment #2)
> 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, ...

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).

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20170911/0f3cbdd2/attachment.html>


More information about the Libreoffice-bugs mailing list