Diwali Offer!Flat 20% OFF
Enroll Now
PrakalpanaLive online tech training
Data Analytics⏱️ 12 min readπŸ“… Nov 26

Power BI Time Intelligence in DAX (2026): YTD, MTD, YoY, Rolling 12 Months and Fiscal Year

RM
Rohit Malhotraβ€’BI Developer
πŸ“‘ Contents (18 sections)

πŸ“ŒWhat Is Time Intelligence?

Time intelligence means comparing numbers across periods: year to date, last year, growth, rolling totals and moving averages. It is the most requested DAX skill in Power BI jobs and interviews, because every business report compares "now" with "before".

DAX has dedicated time intelligence functions, but they only work correctly with a proper date table. If DAX is new to you, start with the DAX functions cheat sheet.

πŸ“ŒStep 1: Build the Date Table

Requirements:

  • one row per day, no gaps, covering every year in your data
  • marked as a date table (Table tools, Mark as date table)
  • related one to many to the date column of each fact table
  • Auto date/time turned off in Options
  • Date =
    VAR MinYear = YEAR ( MIN ( Sales[OrderDate] ) )
    VAR MaxYear = YEAR ( MAX ( Sales[OrderDate] ) )
    RETURN
    ADDCOLUMNS (
    CALENDAR ( DATE ( MinYear, 1, 1 ), DATE ( MaxYear, 12, 31 ) ),
    "Year", YEAR ( [Date] ),
    "Quarter", "Q" & QUARTER ( [Date] ),
    "Month", FORMAT ( [Date], "MMM" ),
    "MonthNo", MONTH ( [Date] ),
    "YearMonth", FORMAT ( [Date], "YYYY MM" ),
    "FY", "FY" & IF ( MONTH ( [Date] ) >= 4, YEAR ( [Date] ) + 1, YEAR ( [Date] ) ),
    "FY MonthNo", MOD ( MONTH ( [Date] ) + 8, 12 ) + 1,
    "Weekday", FORMAT ( [Date], "ddd" ),
    "WeekdayNo", WEEKDAY ( [Date], 2 )
    )

    Sort Month by MonthNo and Weekday by WeekdayNo. The FY columns implement the April to March financial year used by most Indian companies. You can also build the date table in Power Query or SQL.

    πŸ“ŒStep 2: Base Measure

    Total Sales = SUM ( Sales[SalesAmount] )

    All time intelligence measures reference this.

    πŸ“ŒYear, Quarter and Month to Date

    Sales YTD = TOTALYTD ( [Total Sales], 'Date'[Date] )
    Sales QTD = TOTALQTD ( [Total Sales], 'Date'[Date] )
    Sales MTD = TOTALMTD ( [Total Sales], 'Date'[Date] )
    Sales FYTD = TOTALYTD ( [Total Sales], 'Date'[Date], "31/03" )

    The equivalent with CALCULATE, useful to understand what happens:

    Sales YTD v2 = CALCULATE ( [Total Sales], DATESYTD ( 'Date'[Date] ) )

    πŸ“ŒLast Year and Growth

    Sales LY = CALCULATE ( [Total Sales], SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
    Sales YoY = [Total Sales] - [Sales LY]
    Sales YoY % = DIVIDE ( [Sales YoY], [Sales LY] )
    Sales YTD LY = CALCULATE ( [Sales YTD], SAMEPERIODLASTYEAR ( 'Date'[Date] ) )

    DATEADD is the flexible version:

    Sales LM = CALCULATE ( [Total Sales], DATEADD ( 'Date'[Date], -1, MONTH ) )
    Sales LQ = CALCULATE ( [Total Sales], DATEADD ( 'Date'[Date], -1, QUARTER ) )
    Sales MoM % = DIVIDE ( [Total Sales] - [Sales LM], [Sales LM] )

    PARALLELPERIOD and PREVIOUSYEAR / PREVIOUSMONTH return whole periods, for example the full previous year regardless of the selected months.

    πŸ“ŒRolling Totals and Moving Averages

    Sales Rolling 12M =
    CALCULATE (
    [Total Sales],
    DATESINPERIOD ( 'Date'[Date], MAX ( 'Date'[Date] ), -12, MONTH )
    )
    Sales 3M Moving Avg =
    AVERAGEX (
    DATESINPERIOD ( 'Date'[Date], MAX ( 'Date'[Date] ), -3, MONTH ),
    [Total Sales]
    )

    The moving average above averages days. For a true average of monthly totals, iterate months:

    Sales 3M Avg (monthly) =
    VAR Months =
    CALCULATETABLE (
    VALUES ( 'Date'[YearMonth] ),
    DATESINPERIOD ( 'Date'[Date], MAX ( 'Date'[Date] ), -3, MONTH )
    )
    RETURN
    AVERAGEX ( Months, [Total Sales] )

    πŸ“ŒRunning Total (All Time)

    Sales Running Total =
    CALCULATE (
    [Total Sales],
    FILTER ( ALL ( 'Date'[Date] ), 'Date'[Date] <= MAX ( 'Date'[Date] ) )
    )

    Use ALLSELECTED instead of ALL if the running total should restart within the selected range.

    πŸ“ŒHandling Partial Periods

    A classic bug: the current month is half finished, so YoY looks terrible. Options:

    Last Sales Date = CALCULATE ( MAX ( Sales[OrderDate] ), ALL ( Sales ) )
    Sales LY Same Days =
    VAR LastDate = [Last Sales Date]
    RETURN
    CALCULATE (
    [Sales LY],
    KEEPFILTERS ( 'Date'[Date] <= EDATE ( LastDate, 0 ) )
    )

    Or add a column IsPastDate to the date table (Date <= last sales date) and filter visuals or measures with it so future dates never show.

    πŸ“ŒWeek Based Calculations

    Standard functions assume calendar months. For retail 4-4-5 calendars or ISO weeks, add Week and WeekYear columns to the date table and write CALCULATE with filters on those columns, for example previous week by WeekIndex minus one. Newer Power BI versions are adding calendar based time intelligence to make custom calendars easier; check current documentation.

    πŸ“ŒSemi Additive Measures: Balances and Inventory

    Balances should not be summed over time. Use the closing value:

    Closing Stock =
    CALCULATE ( SUM ( Inventory[Qty] ), LASTNONBLANK ( 'Date'[Date], CALCULATE ( SUM ( Inventory[Qty] ) ) ) )
    Closing Balance Month = CLOSINGBALANCEMONTH ( SUM ( Accounts[Balance] ), 'Date'[Date] )

    πŸ“ŒCalculation Groups for Time Intelligence

    Instead of writing YTD, LY and YoY for every base measure, create a calculation group (in Tabular Editor or the model view) with items like:

    YTD = CALCULATE ( SELECTEDMEASURE (), DATESYTD ( 'Date'[Date] ) )
    LY = CALCULATE ( SELECTEDMEASURE (), SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
    YoY% = VAR Cur = SELECTEDMEASURE ()
    VAR Prev = CALCULATE ( SELECTEDMEASURE (), SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
    RETURN DIVIDE ( Cur - Prev, Prev )

    One group now works with Sales, Profit, Orders and every other measure.

    πŸ“ŒCommon Time Intelligence Mistakes

  • 1No date table, or one with gaps.
  • 2Using the fact table's date column inside time intelligence functions.
  • 3Forgetting to mark the date table.
  • 4Fiscal year end argument missing for April to March companies.
  • 5Comparing a partial current period with a full prior period.
  • 6Summing balances over time.
  • πŸ“ŒFrequently Asked Questions

    Why does SAMEPERIODLASTYEAR return blank?

    Usually because there is no proper date table, it is not related to the fact, or the previous year has no data.

    What is the difference between DATEADD and SAMEPERIODLASTYEAR?

    SAMEPERIODLASTYEAR shifts back exactly one year. DATEADD shifts by any number of days, months, quarters or years.

    How do I calculate fiscal year YTD in Power BI?

    Use TOTALYTD with a year end date argument, for example "31/03" for an April to March year.

    Is time intelligence asked in interviews?

    Constantly. Practise with Power BI interview questions and scenario based questions.

    πŸ“ŒLearn It Live

    Prakalpana's Power BI course drills time intelligence on real finance and sales models, taught live online with an optional 1-on-1 track. See the Power BI learning path, then WhatsApp or call +91 9180377502 for a free demo.

    RM

    Written by

    Rohit Malhotra

    BI Developer

    πŸš€ Master Data Analytics

    Live online + 1-on-1 Power BI training Β· Join 5000+ developers

    Not sure what to do? Book career counselling (β‚Ή200 / 30 min)

    Not sure what to learn next?

    A 1-on-1 session with an industry mentor and a roadmap built for you. How it works

    1. 1Discuss your goals
    2. 2Get a personal plan
    3. 3Start learning
    Book for β‚Ή200/ 30 min