-1

I would like to create a view that uses aggregation on an entity to display the count and the sum by date. But it should be grouped by date only without time even the original date value has time values. I.e.

Entity: processedTime | amount | value | ... 01/01/2017 08:00:00 | 10 | 1 | ... 01/01/2017 08:18:10 | 10 | 1 | ... 01/01/2017 10:00:00 | 10 | 1 | ... 01/02/2017 08:00:00 | 10 | 1 | ... 01/02/2017 09:30:00 | 10 | 1 | ... ...

the view should output 01/01/2017 | 30 | 3 | ... 01/02/2017 | 20 | 2 | ...

If I create a view with aggregation grouped by the date field, the view also evaluates the time and tries to group by the entire value of the date field. How can I group only by year, month and day without time?

0

Add a field to the view for the date field you want to group by. In the filter config, set the date format to whatever level of granularity you want for the filter (in the image, it's by month), and tick exclude from display. Then you can group by this field.

filter config results

  • That doesn't solve my problem. I want to use aggregation. In your example you are only grouping the items, but I want to group and to aggregate them (using count and sum). – thomas515 Jun 13 '17 at 21:01
  • I don't know that you can build this view completely within the Views UI. Having said that, it would be pretty easy to update your Twig templates to display the row count instead of the actual nodes. Note: you may need the patch in drupal.org/node/2118743 to see what Twig templates Views is using.' – mikeker Jun 15 '17 at 5:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.