Dashboard Mode - EARLIER for row context
Goal
Find the highest sales amount per product category and show which sales records match that highest amount.
Find the highest sales amount per product category and show which sales records match that highest amount.
| ProductCategory | Product | SalesAmount |
|---|---|---|
| Electronics | Phone | 300 |
| Electronics | Laptop | 450 |
| Electronics | Tablet | 450 |
| Furniture | Chair | 150 |
| Furniture | Desk | 200 |
| Furniture | Shelf | 200 |
| Clothing | Shirt | 100 |
| Clothing | Jacket | 120 |
Total Sales = SUM(Sales[SalesAmount])Max Sales per Category = CALCULATE(MAX(Sales[SalesAmount]), FILTER(Sales, Sales[ProductCategory] = EARLIER(Sales[ProductCategory])))Is Max Sale = IF(Sales[SalesAmount] = Sales[Max Sales per Category], "Yes", "No")+----------------------+-------------------------+ | Total Sales | Sales Records Table | | (KPI Card) | (ProductCategory, | | 1970 | Product, SalesAmount, | | | Max Sales per Category,| | | Is Max Sale) | +----------------------+-------------------------+
A slicer on ProductCategory filters the table and KPI card. Selecting a category updates the table to show only that category's sales and updates the total sales accordingly.
The Is Max Sale column can be used to filter the table to show only the top sales per category.
If you add a filter for ProductCategory = Electronics, which rows remain in the table and what is the total sales shown in the KPI card?
Answer: The table shows only Electronics rows:
- Phone (300)
- Laptop (450)
- Tablet (450)
Total Sales KPI updates to 1200 (300 + 450 + 450).