16.6The start and end of a period

What is the date of the last sale? On which day does the quarter start? To answer, several functions return a single date, taken from the context.

16.6.1FIRSTDATE and LASTDATE

In Excel
DAXFIRSTDATELASTDATE
ExcelMIN of the datesMAX of the dates
Match

You need them to know the first or the last date of a column, like the date of the last sale of each city.

FIRSTDATE and LASTDATE return the first and the last date of the context.

FIRSTDATE( <dates> )
LASTDATE( <dates> )

Each one expects a single argument, a date column written with its table, like Sales[Date] or Calendar[Date].

Last Sale = LASTDATE( Sales[Date] )
Power BI accepts this DAX foryes, Measureyes, Calculated columnno, Calculated tableno, Virtual table
In plain words

“I want the last date of the sales shown.”

In a table by city, the New York row shows 3/27/2025, the date of V008. The Chicago row shows 7/14/2025, and the Toronto row 12/2/2025.

Table visual, The “Last Sale” measure by city
CityLast Sale
New York3/27/2025
Chicago7/14/2025
Toronto12/2/2025
Total12/2/2025

This is a reproduction of the Power BI interface for teaching purposes. It differs from the real interface.

Watch out!

The column matters. LASTDATE( Calendar[Date] ) returns the last visible day of the calendar, 12/31/2025 on the 2025 row, even if the last sale dates from 12/2/2025. For the date of a sale, take the Sales column.

Tip

LASTDATE returns a table with a single row. It can therefore act as a filter for CALCULATE. To display the date, MAX( Sales[Date] ) gives the same result.

Practice

Each exercise is solved with the function you just discovered. Two exercises per function, a direct use and a combined use, from easiest to hardest, on data other than the course data. Pick the right formula out of five.

  1. Direct useMeasureDifficulty

    A library records each loan in the “Loans” table. In a table by reader, write the “Last Loan” measure, the most recent date of the “Date” column, with LASTDATE.

    Loans
    ReaderDate
    Léa2/3/2026
    Léa3/17/2026
    Tom1/10/2026

    Which formula should you write for “Last Loan”?

  2. Combined useMeasureDifficulty

    A weather station records one temperature per day in the “Readings” table, with the “Date” and “Degrees” columns. In a card, write the “Last Temperature” measure, the temperature of the most recent day of the period shown.

    Readings
    DateDegrees
    1/10/20264
    1/11/2026-2
    1/12/20261
  3. Direct useMeasureDifficulty

    A sports club records each session in the “Sessions” table. In a table by member, write the “First Session” measure, the oldest date of the “Date” column, with FIRSTDATE.

    Sessions
    MemberDate
    Nina9/12/2025
    Nina9/2/2025
    Omar10/15/2025
  4. Combined useMeasureDifficulty

    The club wants to know the length of the very first session of each member. In a table by member, write the “First Session Minutes” measure, from the “Date” and “Minutes” columns of the “Sessions” table.

    Sessions
    MemberDateMinutes
    Nina9/12/202560
    Nina9/2/202545
    Omar10/15/202590

The rest of this lesson is part of izyDAX Pro

You have just read the first section. The next one, its animations, the exercises and the summary are waiting for you with izyDAX Pro, in a single payment.