Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Change Date format from YYYYMM to MONTH/YYYY

Hello all, The data came 07/20/2020 and I changed it to 202007 and I would like it to be shown as July 2020, any thoughts? I changed the data using this: Next Gate Date 1 = FORMAT('Table'[Next ...
  • edhans's avatar
    6 years ago

    In Power Query (where you posted this) you would use this formula in a new column:

    = Date.MonthName([Date]) & " " & Text.From(Date.Year([Date]))

    If you are using DAX and want a calculated column (not recommended), you could use this:

    DAX Date Text = FORMAT([Date], "MMMM YYYY") 

     In general, try to avoid calculated columns. There are times to use them, but it is rare. Getting data out of the source system, creating columns in Power Query, or DAX Measures are usually preferred to calculated columns. See these references:
    Calculated Columns vs Measures in DAX
    Calculated Columns and Measures in DAX
    Storage differences between calculated columns and calculated tables
    Creating a Dynamic Date Table in Power Query

  • Anonymous's avatar
    Anonymous
    6 years ago

     

    seems even if I have not found where it is documented, that to have in the name of the month you have to use capital M.

     

    MMM (3) for short name MMMM (4) for full name

     

    Table.AddColumn(PreviousStep, "Next Gate Date 1", each Date.ToText([Next Gate Date], "MMM/yyyy"))

  • v-alq-msft's avatar
    6 years ago

    Hi, Anonymous 

     

    Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

     

    Table:

     

    If you want to create a calculated column, you may try the following dax.

    Column = FORMAT('Table'[Next Gate Date],"mmmm yyyy")

     

    If you want to create a custom column in 'Query Editor', you may go to 'Query Editor'=>'Add Columns' ribbon=>'Custom Column', input the following codes.

    Custom = Date.ToText([Next Gate Date],"MMMM yyyy")

     

    Result:

     

    Best Regards

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.