I am trying to create a very simple orders report and the Views calc sum doesn't work on the order totals. Count works fine but sum doesn't. I have included the view that I have created. It just has 2 fields for display. Any assistance would be greatly appreciated.

orders_with_total.view_.txt10.19 KBsher1
Members fund testing for the Drupal project. Drupal Association Learn more


scarr’s picture

I am also having this issue - I'd love to have this sum correctly - let me know if I can help!

scarr’s picture

Component: Documentation » Code
Category: support » feature
zealny’s picture

Hello sher1 and scarr,

I found the way to get sum of order total filed.

First add the filed to views calc
go to admin/structure/views_calc
Base table : Commerce Order
Label : vc Order total (give some name)
Calculation : %field_data_commerce_order_total.commerce_order_total_amount / 100
Format : decimal (2)
Custom function : (I do not know use of this option)

Then go to your view and edit it.
Add field : vc Order total

Go to Settings for 'Views Calc Table' and select 'Display calculation' for field 'vc Order total'

You will see sum total for order total field.

Hope this helps you.

Rosamunda’s picture

Issue summary: View changes

I've followed the instructions but I do get this error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_data_commerce_order_total.commerce_order_total_amount' in 'field list'

roball’s picture

#3, thanks - works for me. However, there is always a "Page SUM" row which displays "0.00".

themic8’s picture

#3 also worked for me. I also get a "Page SUM" row which displays "0.00".