Forum Discussion
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 Gate Date],"YYYYMM")
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- Anonymous6 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"))
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.
7 Replies
- edhans
Community Champion
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 - v-alq-msft
Community Support
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.
- Greg_Deckler
Community Champion
Anonymous - List of FORMATS can be found here. Shouldn't be a need for that though, there is a default pre-defined format for that:
- ziying35
Impactful Individual
Anonymous
Power Query:
Date.ToText([NextGateDate], "yyyyMM")
- ziying35
Impactful Individual
Table.AddColumn(PreviousStep, "Next Gate Date 1", each Date.ToText([Next Gate Date], "yyyyMM"))
- AnonymousNot applicable
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"))
- ziying35
Impactful Individual
Lowercase M means minutes