ccarnley7
ccarnley7

Reputation: 441

Grouping on a summary

So I want to find out how many shipments ship how many different items. For example: I have a report that groups the data by shipment. i.e multiple items per shipment. Now what I want to do is group those on number of items to answer the question, "How many shipments shipped 4 items?"

Something like this:

5 Shipments with 2 items <--------------------- How do I get these groups?
    Shipment # 123443     Number of items: 2  \
    Shipment # 342312     Number of items: 2   \
    Shipment # 218245     Number of items: 2    = These are already groups with a
    Shipment # 342523     Number of items: 2   /   count of items per shipment
    Shipment # 345234     Number of items: 2  /

2 Shipments with 3 items  
    Shipment # 218154     Number of items: 3
    Shipment # 1518451    Number of items: 3 

Upvotes: 1

Views: 77

Answers (1)

Ryan
Ryan

Reputation: 7287

You'll have to implement this on the DB side or via a SQL Command or SQL Expression in CR. For example, something like the following SQL Expression would work:

(select count(item)
from shipment
where shipmentID = "shipment"."shipmentID")

Then just group on this new expression which will give you the number of items per shipment for every row in your report.

Upvotes: 1

Related Questions