Agent | Customer | Order_id
In each row, that represents a single order, i have the agent, the customer and the order_id.
In the report i need to group by agent, then by agent's customers, showing for each agent and customer the count of their orders, then for each customer i must show the detail of the orders id.
Report's structure is as follows:
Group Band (Agent)
Group Band (Customer)
Data band (Orders)
Example or report (i use "code" tag for showing indentation):
Code: Select all
Agent "1": Number of orders: 4
Customer "A": Number of orders: 3
Order_Id: 1
Order_Id: 2
Order_Id: 3
Customer "B": Number of orders: 1
Order_Id: 4
Agent "2": Number of orders: 2
Customer "C": Number of orders: 2
Order_Id: 5
Order_Id: 6
I ask your kind help because i need to consider only the customers that have a count of orders greater than 2: the total of the agent must consider only the customers effectively printed.
So, if i consider only the customers that have a count of orders greater than 2, the report above should be as follows:
Code: Select all
Agent "1": Number of orders: 3
Customer "A": Number of orders: 3
Order_Id: 1
Order_Id: 2
Order_Id: 3
Note that the orders count of the Agent "1" considers only the orders of the Customer "A" that is printed, while the Agent "2" is not printed at all because it has not Customers that have a number of orders greater than 2.
May you kindly help me on how i can accomplish this?
Thank you.