Forum Discussion

Nsimpson's avatar
Nsimpson
Frequent Visitor
7 years ago
Solved

Need help to convert text YYYYMM to date.

I have a text column YYYYMM that I need to convert to a date (ex: 201904 convert to 4/1/2019) in the query editor.  I would then like to filter the new date column to only include the last 24 months ...
  • parry2k's avatar
    7 years ago

    Nsimpson add new custom colum in power query as below, replace column1 with your column name, once new custom column is added, change data type date

     

    #date(
    Number.FromText(Text.Start([Column1], 4)), 
    Number.FromText(Text.Middle([Column1], 4,2)), 
    1)