ML with circles

Mearns Learns

Build a date from text month and year

If you have a month name and a year, you can convert them to a date showing the start or end of the month.

Month = Dec

Year = 2019

SoM_Date = Date.From( "1/" & [Month] & "/" & Text.From([Year]))

The result of the calculation in a UK dd/mm/yyyy format is:

SoM_Date = 1/12/2019

To get the end of the month, use Date.EndOfMonth

EoM_Date = Date.EndOfMonth( Date.From( "1/" & [Month] & "/" & Text.From([Year])))

The result of the calculation in a UK dd/mm/yyyy format is:

EoM_Date = 31/12/2019

If the parameters are all numeric, the formulas are simpler.

Month = 12

Year = 2019

The formulas would change to

SoM_Date = #date([Year],[Month],1))

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