Assuming we have a calendar table ("Calendar") and a "Date" field containing the dates, we can access the dates involved in the current context through said field. This allows us to access the first day, the last day, etc. of the period involved in the current context using DAX functions and simple arithmetic operations.
Thus, for example, we can access the first day of the current context by calculating the minimum value of the date column with the MIN function, as follows:
Primer día = MIN('Calendar'[Date]) // First date
To see it in operation, let's take our Calendar[Date] field to a matrix, navigate through the hierarchical structure of the date until it shows, for example, the months, and add the created measure:
We see that, indeed, the measure returns the first day of the period indicated in the header of each row.
We can calculate the last day of the current context similarly, using the MAX function:
Último día = MAX('Calendar'[Date]) // Last day
In fact, we could access the next day of the current context (or any other day that we could refer to the first or last day of the current context) by adding 1 to the maximum value:
Siguiente día = MAX('Calendar'[Date]) + 1 // Next day
If we take these measures to our matrix, we would obtain the following result:
If we were to take these measures to a matrix in which we have not included the Calendar[Date] field in rows, the minimum and maximum values would coincide with the first and last date of the calendar (without additional restrictions):
The image above is the one corresponding to a calendar that includes all the dates between January 1, 2013, and December 31, 2016. Note that the result returned by the Siguiente día measure (January 1, 2017) is not included in the calendar.