Dashboard Mode - GROUP BY with aggregation
Goal
Find total sales for each product category to see which category sells the most.
Find total sales for each product category to see which category sells the most.
| Order ID | Product | Category | Sales |
|---|---|---|---|
| 1001 | Notebook | Stationery | 15 |
| 1002 | Pen | Stationery | 10 |
| 1003 | Chair | Furniture | 120 |
| 1004 | Desk | Furniture | 250 |
| 1005 | Stapler | Stationery | 8 |
| 1006 | Lamp | Furniture | 75 |
| 1007 | Marker | Stationery | 12 |
=QUERY(A1:D8, "select C, sum(D) group by C", 1)=INDEX(QUERY(A1:D8, "select C, sum(D) group by C order by sum(D) desc limit 1", 1), 2, 1)=SUM(D2:D8)+----------------------+------------------+ | Total Sales (KPI) | Top Category (KPI)| +----------------------+------------------+ | Summary Table (Grouped Sales) | +----------------------------------------------+
Add a filter dropdown for Category. When you select a category, the Summary Table and KPIs update to show data only for that category.
If you filter to show only 'Furniture' category, what is the total sales shown in the Total Sales KPI?
Answer: 445 (120 + 250 + 75)
GROUP BY clause do in a Google Sheets QUERY function?A | B
--|--
Cat | 2
Dog | 3
Cat | 4
Dog | 1
Bird | 5=QUERY(A1:B5, 'SELECT A, SUM(B) GROUP BY A ORDER BY SUM(B) DESC')=QUERY(A1:C10, 'SELECT A, C, COUNT(B) GROUP BY A')Region, Salesperson, and Amount. You want to find the total sales per region but only include regions where total sales exceed 1000. Which QUERY formula achieves this?Pass the test and this pattern moves unknown