1. Lighthouse

Level 6 · Previous month and MoM % with DATEADD

The request

From Olivia Grant, E-commerce Manager

“My weekly trading call wants momentum, not annual totals: for each month of 2025, did sales go up or down compared with the month before, in percent? January should compare with December 2024, not show a blank.”

Your goal

The matrix has 'Date'[Year Month] on its rows and a 'Date'[Year] slicer on 2025. Write two measures: Sales PM (Sales of the previous month, with CALCULATE and DATEADD('Date'[Date], -1, MONTH)), then Sales MoM % = (Sales − Sales PM) ÷ Sales PM with DIVIDE. The last measure is checked.

  • Fill [Sales MoM %] on every row of the visualnot done yet
  • The Total row right toonot done yet

Your measure

DAX
Visual
A matrix: rows = 'Date'[Year Month]; values = [Sales], [Sales MoM %]
Slicers
'Date'[Year] = 2025
Measures in the report
Sales = CALCULATE(SUM(order_items[line_total]), orders[status] = "completed")
Data pane: tables and columns
  • order_items order_item_id, order_id, product_id, quantity, unit_price, discount_pct, line_total
  • orders order_id, customer_id, order_date, status, channel, shipping_fee, coupon_code
  • products product_id, name, category, subcategory, unit_price, unit_cost, launched_on, is_active
  • customers customer_id, first_name, last_name, email, city, state, signup_date, segment, referral_source
  • returns return_id, order_item_id, returned_on, reason, refund_amount
  • Date Date, Year, Quarter, Month Number, Month, Year Month, Year Quarter, Day, Weekday Number, Weekday

Loading the editor…

    Visual[Sales MoM %] fills in when you press Check
    The visual before your answer
    Year MonthSalesSales MoM %
    2025-01$150,571
    2025-02$99,903
    2025-03$166,787
    2025-04$189,734
    2025-05$206,469
    2025-06$213,062
    2025-07$191,967
    2025-08$182,987
    2025-09$143,379
    2025-10$174,599
    2025-11$292,364
    2025-12$288,346
    Total$2,300,170

    Mote checks your result

    Press Check. Mote fills in your answer and compares it with what the report needs.

    The lesson

    Year over year removes seasonality; month over month (MoM) shows momentum. A trading team looks at both: is this month better than the same month last year, and is it better than last month?

    What you are working in

    This page runs a practice DAX engine built for this site. It evaluates your last measure for each month of 2025 and the Total row, and checks every cell. In Power BI Desktop: create each measure with Home → New measure, format the second one as a percentage, and put 'Date'[Year Month] on the matrix rows.

    DATEADD shifts dates by any interval

    Sales PM = CALCULATE([Sales], DATEADD('Date'[Date], -1, MONTH))

    DATEADD(dates, number, interval) takes the visible dates and moves each one by number units of interval (DAY, MONTH, QUARTER or YEAR). Negative goes back in time. For the row 2025-03:

    • visible dates: March 1–31, 2025
    • shifted: February 1–28, 2025 (a month-end day maps to the end of the shorter month)
    • [Sales] evaluated on those dates: February’s sales

    DATEADD('Date'[Date], -1, YEAR) is the same as SAMEPERIODLASTYEAR, and -1, QUARTER gives the previous quarter. One function covers every shift.

    Measures that use measures

    Sales MoM % = DIVIDE([Sales] - [Sales PM], [Sales PM])

    Writing Sales PM as its own measure, instead of a variable, makes it reusable: it can sit in the matrix next to Sales, feed a tooltip, or be checked on its own. Variables are best for values only one measure needs.

    January and the Year slicer

    The 2025-01 row has two filters on the calendar: Year = 2025 and Year Month = 2025-01. DATEADD produces December 2024, outside the slicer’s year. CALCULATE still sees it, because a filter on the marked Date table’s date column replaces every other filter on that table. So January compares with December 2024, as Olivia asked: down 48.2% after the holiday peak.

    DATEADD or PREVIOUSMONTH?

    PREVIOUSMONTH('Date'[Date]) returns the whole month before the first visible date. On a single month it equals DATEADD by −1 month. On the Total row (all of 2025) it returns December 2024 only, while DATEADD shifts the whole year back a month. DATEADD keeps the period’s length, which is usually what a comparison needs.

    Common mistakes

    • A hard-coded month. 'Date'[Month Number] = MONTH(TODAY()) - 1 breaks in January and ignores the row.
    • Comparing months of different length. February has three fewer days than March; part of March’s 66.9% jump is the calendar. For fair momentum, compare average daily sales or weeks.
    • Reading MoM as trend. Month-over-month swings with seasons. Look at YoY next to it before calling a decline.

    Pick what may run on this site. You can change this any time from "Cookie settings" at the bottom of every page.