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
| DAX | FIRSTDATE | LASTDATE |
|---|---|---|
| Excel | MIN of the dates | MAX 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.
Each one expects a single argument, a date column written with its table, like Sales[Date] or Calendar[Date].
“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.
| City | Last Sale |
|---|---|
| New York | 3/27/2025 |
| Chicago | 7/14/2025 |
| Toronto | 12/2/2025 |
| Total | 12/2/2025 |
This is a reproduction of the Power BI interface for teaching purposes. It differs from the real interface.
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.
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.
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 Reader Date Léa 2/3/2026 Léa 3/17/2026 Tom 1/10/2026 Which formula should you write for “Last Loan”?
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 Date Degrees 1/10/2026 4 1/11/2026 -2 1/12/2026 1 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 Member Date Nina 9/12/2025 Nina 9/2/2025 Omar 10/15/2025 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 Member Date Minutes Nina 9/12/2025 60 Nina 9/2/2025 45 Omar 10/15/2025 90
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.