Ravindra BagaleCourses & study guides मराठी Track your progress

11. Data Modelling

11.5 Date Table in Power BI with Example (April–March FY)

Start with a problem

Salman's month chart skips days with no orders, and his YTD measure restarts in January. There is no Date table.

Explain simply

A Date table has one row for every day, with no gaps, plus Month and FY columns. Mark it as the date table and relate it to Orders.

Show the data

Order dates in the practice file (gaps between them):

Order Date Orders
06-04-2026 2
07-04-2026 1
04-05-2026 2
05-05-2026 3

About this data: This table uses columns: Order Date, Orders. This table uses columns: Date, Month Name, FY Month No, FY. This table uses columns: Month Name, Total Sales (₹), Sales YTD (₹). This table uses columns: Order Date, Amount (₹). Values shown are the lesson examples already on this page (not a new dataset).

Fictional sample data. Practice file: visuals_orders_apr_may_2026.csv (source: src/practice/).

Demonstrate

  1. Modeling › New table: Date = CALENDAR(DATE(2026,4,1), DATE(2027,3,31)).

    Your result should look like this:

    Rows
    365 (01-04-2026 to 31-03-2027)
  2. Add calculated columns: Month Name = FORMAT('Date'[Date], "MMM"), FY Month No = MOD(MONTH('Date'[Date]) - 4, 12) + 1, FY = "FY " & IF(MONTH('Date'[Date]) >= 4, YEAR('Date'[Date]), YEAR('Date'[Date]) - 1) & "-" & RIGHT(IF(MONTH('Date'[Date]) >= 4, YEAR('Date'[Date]) + 1, YEAR('Date'[Date])), 2).

    Your result should look like this:

    Date Month Name FY Month No FY
    01-04-2026 Apr 1 FY 2026-27
    15-01-2027 Jan 10 FY 2026-27
    31-03-2027 Mar 12 FY 2026-27
  3. Select the table › Table tools › Mark as date table › Date column.

  4. Month Name › Sort by column › FY Month No.
  5. Relate Date[Date] 1 → * Orders[Order Date]. Turn off Auto date/time (File › Options › Current file › Data load).
  6. Measure Sales YTD = TOTALYTD([Total Sales], 'Date'[Date], "31/3").

    Your result should look like this:

    Sales YTD at 05-05-2026
    ₹2,100

Show the result

Your result should look like this (fictional sample):

Month Name Total Sales (₹) Sales YTD (₹)
Apr 900 900
May 1,200 2,100

Explain what happened

CALENDAR produced every day of FY 2026-27. Marking it told Power BI to use it for time intelligence, and the "31/3" year-end made YTD restart in April instead of January.

Explore further

  • 2028 is a leap year, so FY 2027-28 has 366 days. CALENDAR handles that for you.

Detailed reference for this lesson:

Date table in Power BI with example (Indian FY April–March) — in 30 seconds

What: A date table has one row for every day, with no gaps, plus Year, Month and FY columns.

Why: YTD, last year and month charts need every date. Orders tables skip days with no sales.

Tiny example: Orders have 30-Mar and 1-Apr only. The Date table also has 31-Mar. 1-Apr starts FY 2025-26.

First look at the data (before → after):

Date table in Power BI with example (Indian FY April–March): before and after tables, fictional Blinkit Maharashtra data

Same before / after tables as text

Before — Order dates (31-Mar missing)

Order Date Amount (₹)
30-03-2025 800
01-04-2025 600

Formula / click path

Date = CALENDAR(DATE(2024,4,1), DATE(2026,3,31))
FY = IF(MONTH([Date]) >= 4, YEAR([Date]), YEAR([Date]) - 1)
Table tools › Mark as date table

After — Date table (continuous, with FY)

Date Month FY start year FY label
30-03-2025 Mar 2024 FY 2024-25
31-03-2025 Mar 2024 FY 2024-25
01-04-2025 Apr 2025 FY 2025-26

Do it step by step:

  1. Click Modeling › New table.
  2. Type the CALENDAR formula. Press Enter.
  3. Add columns: Month, FY start year, FY label.
  4. Click Table tools › Mark as date table. Choose the Date column.
  5. Relate Date[Date] to Orders[Order Date] (one to many).
  6. Turn off File › Options › Current file › Data load › Auto date/time.

Time analysis (YTD, previous year, month-on-month) needs a proper date table:

  • one row per day, no gaps, covering full years of your data;
  • a column of type Date with unique values;
  • related to the date columns in fact tables.

Option 1: CALENDAR

CALENDAR(<start_date>, <end_date>) returns a single-column table named Date with every date in the range.

Date =
ADDCOLUMNS(
    CALENDAR(DATE(2023, 1, 1), DATE(2026, 12, 31)),
    "Year", YEAR([Date]),
    "Quarter", "Q" & QUARTER([Date]),
    "Month Number", MONTH([Date]),
    "Month Name", FORMAT([Date], "MMMM"),
    "Month Short", FORMAT([Date], "MMM"),
    "Year Month", FORMAT([Date], "YYYY-MM"),
    "Day Name", FORMAT([Date], "dddd"),
    "Weekday Number", WEEKDAY([Date], 2),
    "Is Weekend", WEEKDAY([Date], 2) > 5
)

Create it with Modeling › New table (or Table tools › New table).

A dynamic range based on the fact table:

Date =
CALENDAR(
    DATE(YEAR(MIN(Orders[Order Date])), 1, 1),
    DATE(YEAR(MAX(Orders[Order Date])), 12, 31)
)

Option 2: CALENDARAUTO

CALENDARAUTO([fiscal_year_end_month]) scans all date columns in the model (excluding calculated columns/tables) and builds full years covering them. For an Indian financial year ending in March:

Date = CALENDARAUTO(3)

CALENDARAUTO pitfall

Friends, because it scans every date column in the model, a single wrong date such as a birth date in 1950 or a placeholder 01-01-1900 will create decades of extra dates. CALENDAR gives you more control.

Option 3: Build it in Power Query or the data warehouse

Many teams create the date table in the source database or in Power Query (M), especially when the same calendar is shared across reports. This is equally valid.

Fiscal year columns (Indian FY: April–March)

Fiscal Year =
VAR m = MONTH('Date'[Date])
VAR y = YEAR('Date'[Date])
RETURN
    IF(m >= 4, "FY " & y & "-" & RIGHT(y + 1, 2), "FY " & (y - 1) & "-" & RIGHT(y, 2))

For 14-03-2025 this returns FY 2024-25; for 14-04-2025 it returns FY 2025-26.

Festival column (Indian context)

Quick-commerce orders in our sample data rise sharply around festivals such as Diwali and Ganeshotsav. Festival dates change every year, so keep a small table Festivals (columns Date and Festival, typed in with Home › Enter data or maintained in Excel) and bring the name into the Date table as a calculated column:

Festival =
LOOKUPVALUE(Festivals[Festival], Festivals[Date], 'Date'[Date])

Is Festival Day = NOT ISBLANK('Date'[Festival])

Later you can write measures such as CALCULATE([Total Orders], 'Date'[Is Festival Day] = TRUE()) or compare festival weeks year on year (Module 13.16).

Mark as date table

Look: select the Date table › Table tools › Mark as date table › choose the Date column. Power BI validates that the column is of Date type, has unique values and no blanks.

Why mark it?

  • Time intelligence (कालावधीनुसार विश्लेषण) functions work reliably with your own calendar.
  • Power BI stops creating hidden auto date/time tables for this table.

Sort Month Name by Month Number

By default, text months sort alphabetically (April, August, December…). Fix: select Date[Month Name] › Column tools › Sort by column › Month Number. Do the same for Day Name (sort by Weekday Number).

Turn off Auto date/time

Power BI by default creates a hidden date table for every date column (Auto date/time), which bloats the model. Once you have your own date table, turn it off: File › Options and settings › Options › Current File › Data Load › Time intelligence › Auto date/time (untick). You can also untick it in Global for new files.

Split date and time

Orders[Order DateTime] has a different value for almost every order (high cardinality). Relate the Date table to a date-only column (Order Date) and keep the hour in a separate small column (Order Hour, 0–23) for "orders by hour of day" analysis. We created both in Power Query (Module 4.16).

Date table shivay time intelligence nahi – he vakya lihun theva, mitrano.

Ravindra Bagale's Tip

Friends, remember: forgetting to Mark as date table is the classic mistake, and so is using a Date table with gaps or only the dates that have sales. Build a continuous calendar covering whole years, mark it, relate it to a date-only column, and turn off Auto date/time. Then time intelligence works reliably. Remember this rule.

Fix common mistakes

Wrong result Reason Correction
Months sort Apr, Aug, Dec… Month Name sorted alphabetically Sort by column › FY Month No
YTD restarts in January No year-end date given TOTALYTD(…, "31/3")
Time-intelligence results are blank or wrong Date table not marked, or it has gaps Use CALENDAR for the full range; Mark as date table

Practise independently

Practice task

How many rows does the Date table have for FY 2027-28 (01-04-2027 to 31-03-2028)? What is the FY Month No of 29-02-2028?

Hints
  • Is February 2028 a leap month?
Solution

366 rows (February 2028 has 29 days). February is FY month 11: MOD(2 − 4, 12) + 1 = 10 + 1 = 11.

Think like a professional

One Date table, marked, with FY columns, owned by the model and reused by every report page.

Loading DAX practice tasks...

  1. Year number (Easy): Calculated column on Date: Year No = the year of the Date column.
  2. Month number (Easy): Calculated column on Date: Month No = the month number of Date.
  3. Day of month (Easy): Calculated column on Date: Day No = the day of the month.
  4. Days in the table (Easy): Measure: Day Count = number of rows in Date.
  5. Calendar quarter label (Medium): Calculated column on Date: Qtr = "Q" followed by the calendar quarter number, like Q1.
  6. FY start year (Medium): Calculated column on Date: FY Start = the year if the month is April or later, else the year minus 1.
  7. FY month number (Medium): Calculated column on Date: FY Month = month − 3 for April to December, month + 9 for January to March.
  8. FY label (Hard): Calculated column on Date: FY Name = "FY " followed by the FY start year.
  9. Weekend flag (Hard): Calculated column on Date: Day Type = "Weekend" if WEEKDAY with type 2 is 6 or more, else "Weekday".
  10. Days with orders (Hard): Shown per FY. Measure: Order Days = number of different OrderDate values.

Ravi Sir's Cards for this lesson

मराठी cards