I am trying to find out the top 3 customers from a list. I want to do this based on the number of orders.
At the end I would like to be able to display the following values:
| Client | Amount of Orders | Summed Amount of Ordervalue |
|---|---|---|
| A | 4 | 1.400€ |
| D | 3 | 1.200€ |
| C | 2 | 400 € |
My output table is like the following just with way more clients
| Client | Order type | Amount per Order |
|---|---|---|
| A | Container | 300 € |
| A | Container | 300 € |
| C | Trucking | 200 € |
| B | Storage | 100 € |
| A | Trucking | 400 € |
| A | Trucking | 400 € |
| D | Container | 600 € |
| C | Trucking | 200 € |
| D | Container | 300 € |
| D | Container | 300 € |
CodePudding user response:
You may use below formula.
=QUERY(A1:C,"select A, count(A), sum(C)
where A is not null
group by A
order by count(A) DESC
limit 3")
CodePudding user response:
Try following query
Select Client,Count(Client) 'Amount of Orders',Sum(Amount) 'Summed Amount of
Ordervalue' From OrderDetails Group By Client

