Forum Discussion

Bryan123's avatar
Bryan123
Brass Contributor
Sep 29, 2022
Solved

Power Query - extracting Month Year from 1/1/2022

I have a date column formatted as 1/1/2022.  I want to convert it in PQ to Jan 2022 but keep it as a date.   I've found a bunch of examples for DAX but they don't work.  I found a Datetotext method...
  • Martin_Weiss's avatar
    Sep 30, 2022

    Hi Bryan123 

     

    it is as you described already. If you try to convert your date into something like "Jan 2022", the result will always be text. The reason is easy: Because there is no day anymore in this field, how could it be a valid date? So it's not just a formatting issue, but a data type issue.

     

    If you really need it that way, you could keep the original date column, create a new column with the desired one ("Jan 2022") and sort that table based on the original date.

    Or, if you load the query results back into an Excel table, only keep the original date and do the formatting directly in Excel.

Resources