Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Omid_Motamedise
Super User
Super User

Date.EndOfMonth

Today, I encountered a strange behavior with the Date.EndOfMonth function in Power Query.

Consider the source table below (in Excel):

 

DateProductQty
19/07/2024 A37
20/07/2024 B12

 

I used the following code to add a new column to extract the end day of the month for each date:

= Table.AddColumn(Source, "Custom", each Date.EndOfMonth([Date]))

 

Surprisingly, the result was the first day of the next month instead of the expected end of the month, as shown below:

Omid_Motamedise_0-1733193572266.png

even if the type of this column change to DateTime it provide the same results, but it does work just when the data are in type Date.

If my answer helped solve your issue, please consider marking it as the accepted solution. It helps others in the community find answers faster—and keeps the community growing stronger!
You can also check out my YouTube channel for tutorials, tips, and real-world solutions in Power Query with the following link
https://youtube.com/@omidbi?si=96Bo-ZsSwOx0Z36h
1 ACCEPTED SOLUTION
Anonymous
Not applicable

I would guess that since neither of your date, columns are actually type date or even type datetime, that power query is treating it as a number and is rounding it up to the next number, which is the next day. Notice that your value has the time of 23:59:59.99999, which is as close to the end of the month as possible, but if you had a proper date value, it would have been 00:00:00, which would be the right date. Yours is a type misstep, not a Power Query issue.

 

--Nate

View solution in original post

1 REPLY 1
Anonymous
Not applicable

I would guess that since neither of your date, columns are actually type date or even type datetime, that power query is treating it as a number and is rounding it up to the next number, which is the next day. Notice that your value has the time of 23:59:59.99999, which is as close to the end of the month as possible, but if you had a proper date value, it would have been 00:00:00, which would be the right date. Yours is a type misstep, not a Power Query issue.

 

--Nate

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.