0
0
Power BIbi_tool~8 mins

SAMEPERIODLASTYEAR in Power BI - Dashboard Guide

Choose your learning style9 modes available
Dashboard Mode - SAMEPERIODLASTYEAR
Business Question

How did our monthly sales perform this year compared to the same months last year?

Sample Data
MonthYearSales
January20231000
February20231200
March20231500
January2022900
February20221100
March20221300
Dashboard Components
  • KPI Card: Total Sales This Year
    Formula: Total Sales = CALCULATE(SUM(SalesData[Sales]), SalesData[Year] = 2023)
    Result: 3700
  • KPI Card: Total Sales Last Year
    Formula: Sales LY = CALCULATE(SUM(SalesData[Sales]), SAMEPERIODLASTYEAR(SalesData[Date]))
    Result: 3300
  • Line Chart: Monthly Sales Comparison
    X-axis: Month
    Y-axis: Sales
    Series: This Year and Last Year
    Measures:
    Sales This Year = CALCULATE(SUM(SalesData[Sales]), SalesData[Year] = 2023)
    Sales Last Year = CALCULATE(SUM(SalesData[Sales]), SAMEPERIODLASTYEAR(SalesData[Date]))
  • Table: Sales by Month and Year
    Columns: Month, Year, Sales
Dashboard Layout
+----------------------+----------------------+
| Total Sales This Year | Total Sales Last Year |
+----------------------+----------------------+
|                      Line Chart               |
|          Monthly Sales Comparison              |
+-----------------------------------------------+
|                 Sales by Month Table           |
+-----------------------------------------------+
Interactivity

A slicer for Year allows users to select 2023 or 2022. When the year changes, the KPI cards and line chart update to show sales for the selected year and the same period last year. The table filters to show only data for the selected year.

Self Check

If you add a filter selecting only February, which components update and what sales values do they show?

  • KPI Cards: Show sales for February 2023 (1200) and February 2022 (1100).
  • Line Chart: Shows only February points for both years.
  • Table: Shows only February rows for both years.
Key Result
Dashboard compares monthly sales this year to the same months last year using SAMEPERIODLASTYEAR.