EOMonth in M language

albertan

Member
Joined
Nov 9, 2017
Messages
30
Reaction score
0
Points
6
Location
Canada
Excel Version(s)
2013
Hello, I have a year and month columns in text format (for example "2020" and "02") and I need to create another column with end of the month date. I had to do it in several steps, i.e. concatenate the year with month, convert it to date and then use Date.EndOfMonth formula. I was wondering if anyone can please suggest a shorter version.

#"Added Custom1" = Table.AddColumn(#"Renamed Columns2", "Posting Date", each [Fiscal Year]&[Period] &"28"),
#"Changed Type" = Table.TransformColumnTypes(#"Added Custom1",{{"Posting Date", type date}}),
#"Added Custom2" = Table.AddColumn(#"Changed Type", "EOM", each Date.EndOfMonth([Posting Date]))
in
#"Added Custom2"
 
As in something like this? (written in browser and not tested)

Code:
Date.EndOfMonth( #date( [Fiscal Year], [Period], 1 ) )
 
Back
Top