0
0
Power BIbi_tool~8 mins

EARLIER for row context in Power BI - Dashboard Guide

Choose your learning style9 modes available
Dashboard Mode - EARLIER for row context
Goal

Find the highest sales amount per product category and show which sales records match that highest amount.

Sample Data
ProductCategoryProductSalesAmount
ElectronicsPhone300
ElectronicsLaptop450
ElectronicsTablet450
FurnitureChair150
FurnitureDesk200
FurnitureShelf200
ClothingShirt100
ClothingJacket120
Dashboard Components
  • KPI Card: Overall Total Sales
    Formula: Total Sales = SUM(Sales[SalesAmount])
    Result: 1970
  • Calculated Column: Max Sales per Category
    Formula:
    Max Sales per Category = CALCULATE(MAX(Sales[SalesAmount]), FILTER(Sales, Sales[ProductCategory] = EARLIER(Sales[ProductCategory])))
    This finds the highest sales amount within the same product category for each row.
  • Table Visual: Sales Records with Max Sales Flag
    Columns: ProductCategory, Product, SalesAmount, Max Sales per Category
    Shows each sale and the max sales in its category.
    Example rows:
    Electronics - Laptop - 450 - 450
    Electronics - Phone - 300 - 450
  • Calculated Column: Is Max Sale
    Formula:
    Is Max Sale = IF(Sales[SalesAmount] = Sales[Max Sales per Category], "Yes", "No")
    Used to highlight or filter rows that have the max sales in their category.
Dashboard Layout
+----------------------+-------------------------+
|      Total Sales      |    Sales Records Table   |
|      (KPI Card)       |  (ProductCategory,       |
|        1970           |   Product, SalesAmount,  |
|                      |   Max Sales per Category,|
|                      |   Is Max Sale)           |
+----------------------+-------------------------+
Interactivity

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.

Self Check

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).

Key Result
Dashboard shows total sales and highlights highest sales per product category using EARLIER for row context.