I am using a view which includes a field with multiple values. I do not want that, due to that field, some rows are shown more than once. There for I set "Multiple field settings" to "Display all values in the same row".
But Views Calc counts nevertheless the rows that have more than one value within that field as if it where not grouped:

| NR | field with single value    |   field with multiple value     |  field to calc  |
|----|----------------------------|------------------------------ --|-----------------|
|  1 | Some value                 | value1, value2, value3          |    1            |
|  2 | An other value             | value1                          |    5            |
|  3 | Something                  | value1, value2                  |    2            |
| Total SUM                                                              12           |

The example shows how the module calcs, but I would expect 8 as result.

Members fund testing for the Drupal project. Drupal Association Learn more


GrahamShepherd’s picture

I have encountered exactly the same thing. My example is a view of page view statistics of a content type (journal articles) where there are multiple authors per article. The authors are displayed in one row with a comma separator. The required SUM is the total number of page views of the content type. The actual SUM displayed is the SUM (number of authors x page reads).

If I remove the multiple author field from the view, the SUM returns to the correct value.

mthomas’s picture

Same here. If multiple values are present in a field, the sum calculation duplicates the row for however many occurrences of that field; yielding an incorrect sum value.

mgifford’s picture

Has anyone come up with a solution for this yet?

8bitplateau’s picture

Just to confirm that using 'distinct' does not make any difference.
It is essentially not compatible with primary features of views.

Beer money and multiple bigups to anyone who fixes this.

dchatry’s picture

A solution for this would be to exclude multiple fields from calculations (see attached patch).
It's not ideal but it seems to do the trick for me!

mgifford’s picture

Status: Active » Needs review
mgifford’s picture

Patch applies nicely. Nice way to just remove the multiple fields. Why isn't it ideal?

dchatry’s picture

I guess it would be better if we could handle calculations on multiple fields instead of just discarding them.

tolegu’s picture

the same. The module counts a row as many times as many values of the multi-valued field are inside.
The patch in #5 works.