cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper I
Helper I

Add custom column with end of month (from month number)

Hi

I am trying to create a custom column in Power BI query editor to display the last day of the month in every row, however the only reference I have in my table is the Month number (1, 2, 3 ...,12) and the year (currently only 2020).

 

I was thinking about using"date.endofmonth"  and reference it to a random date generated from the month number and year, but I just can't find a formula to generate a date from month and year. 

 

Any idea?

Thanks 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

You can add a custom column in the query editor with this expression, using the Year and MonthNumber columns:

 

=Date.EndOfMonth(#date([Year], [MonthNumber],1))

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Please mark my post as a solution! Kudos are also appreciated!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
Super User III
Super User III

You can add a custom column in the query editor with this expression, using the Year and MonthNumber columns:

 

=Date.EndOfMonth(#date([Year], [MonthNumber],1))

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Please mark my post as a solution! Kudos are also appreciated!

Proud to be a Super User!




View solution in original post

Fantastic!, Thanks

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!

secondImage

Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors
Top Kudoed Authors