Forum Discussion
JennyMilf
3 years agoHelper I
Convert text to Date
Hi everyone, How can I convert Year-month from text to Date? I tried: YearMonth_Date = DATE(LEFT(Table[YearMonth], 4), RIGHT(Table[YearMonth], 2), 1) but it's not work Thank you
jaweher899
3 years agoImpactful Individual
please try
YearMonth_Date = DATE(
YEAR(DATEVALUE("01-" & RIGHT(Table[YearMonth], 2) & "-" & LEFT(Table[YearMonth], 4))),
MONTH(DATEVALUE("01-" & RIGHT(Table[YearMonth], 2) & "-" & LEFT(Table[YearMonth], 4))),
1
)