Sum and Average don't work on Drupal Commerce Views

Created on 9 June 2014, over 10 years ago
Updated 7 March 2024, 12 months ago

Hello.

I'm trying to create a simple view of commerce orders which should report of:
- number of orders made by users with certain role
- sum of order totals
- average of order totals.

Now. I have four fields.
1. User ID - on which i group and compress
2. Order ID - to count the number of orders
2. Order total - to calculate SUM
3. Second Order total - to calculate AVG

Aggregate Table

I also have php field to get user roles (but i don't aggregate on it).

And. Grouping works fine. Counting works fine. The sum doesn't show at all. Average shows only the amount of the newest order made by user.

Result Table

Could You please tell me what i'm doing wrong and why I can't see the sum and calculate to average of order amount?

Thanks in advance.

🐛 Bug report
Status

Fixed

Version

1.2

Component

Miscellaneous

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇲🇾Malaysia amal.bukhari

    Hi,

    I'm not using Commerce but I just want to replicate the same table. One column is counted, another is tallied and another is summed.

    Problem is whenever I added "Tally members *", I got this error:

    TypeError: Cannot assign array to property Drupal\views\Plugin\views\field\FieldPluginBase::$last_render of type Drupal\Component\Render\MarkupInterface|string|null in Drupal\views_aggregator\Plugin\views\style\Table->executeAggregationFunctions() (line 540 of /var/www/html//web/modules/contrib/views_aggregator/src/Plugin/views/style/Table.php).

    Kind regards,
    Amal.

Production build 0.71.5 2024