Skip to main content

How to Get the Last Day of the Month in Power Apps

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

Power Fx has no EOMONTH function, but the last day of a month is always the day before the first of the next month. Go forward one month from the first, then back one day: DateAdd(DateAdd(first, 1, TimeUnit.Months), -1, TimeUnit.Days). For November 2026 that's 30/11/2026. Date(year, month + 1, 0) gives the same day.

The example is the Overtime Timesheet app, which needs the end of a month to know which weeks to load.

Prerequisites​

Step 1: Forward a Month, Back a Day​

I put the formula into a text control's Text for a moment, so Studio's preview strip shows the result:

Any text control → Text
DateAdd(DateAdd(Date(2026, 11, 1), 1, TimeUnit.Months), -1, TimeUnit.Days)

The inner DateAdd goes to 1 December, and the outer one goes back a day to 30/11/2026:

The formula bar with DateAdd(DateAdd(Date(2026, 11, 1), 1, TimeUnit.Months), -1, TimeUnit.Days), the preview strip reading 30/11/2026, 00:00:00 with Data type Date, and the text control showing 30/11/2026

Step 2: Check a Leap-Year February​

2028 is a leap year, so its February has 29 days:

Any text control → Text
DateAdd(DateAdd(Date(2028, 2, 1), 1, TimeUnit.Months), -1, TimeUnit.Days)

The formula bar with the same formula for Date(2028, 2, 1), the preview strip reading 29/02/2028, 00:00:00 with Data type Date, and the text control showing 29/02/2028

Nothing in the formula counts days: the calendar does it.

Step 3: The Shorter Way, Day 0​

Microsoft's Date function reference: If Day is less than 1, the function subtracts that many days, plus 1, from the first day of the specified month. Day 0 is therefore the day before the first, the last day of the month before:

Any text control → Text
Date(2026, 12, 0)

The formula bar with Date(2026, 12, 0), the preview strip reading 30/11/2026, 00:00:00 with Data type Date, and the text control showing 30/11/2026

For any date d, that's Date(Year(d), Month(d) + 1, 0). For December, Month(d) + 1 is 13, and the same reference says a month above 12 adds that many months from the start of the year.

How the Example Uses It​

The My Overtime screen keeps the month it shows as its first day, locMonthMO. To load whole weeks, it needs the Sunday of the week that holds the month's last day, so the last day comes first:

Part of btnRefreshMO → OnSelect
ToDate: DateAdd(
MondayOf(DateAdd(DateAdd(locMonthMO, 1, TimeUnit.Months), -1, TimeUnit.Days)),
6,
TimeUnit.Days
)

For November 2026, the last day is Monday 30 November, its week runs to Sunday 6 December, and the screen loads entries up to that date: How to Find the Monday of a Week in Power Apps.

Common Mistakes​

MistakeWhat happensDo this instead
Adding 30 days to the first of the monthThe wrong day in every month that isn't 30 days longForward a month, back a day
Date(year, month, 31)In a 30-day month it rolls over into the next monthDay 0 of the next month

Troubleshooting​

SymptomLikely causeFix
The result is the first of the monthThe outer DateAdd is missingGo back -1 day after going forward a month
00:00:00 after the date in the stripThe strip shows the whole valueFormat it where people see it with Text

FAQ​

How many days are in the month?​

Day(lastDay) is the number of days: 30 for November, 29 for February 2028.

How does Excel do this?​

Excel has EOMONTH, and the day-0 trick works with its DATE too: How to Get the First Day of the Next Month in Excel with EDATE shows the month arithmetic.

Conclusion​

The last day of a month is one day before the first of the next: DateAdd(DateAdd(first, 1, TimeUnit.Months), -1, TimeUnit.Days), or Date(year, month + 1, 0). Both leave the counting of days to the calendar.

Additional Resources​