Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

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")


BrennoCosta7_0-1595619588242.png

 

3 ACCEPTED SOLUTIONS
edhans
Super User
Super User

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



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

Anonymous
Not 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"))

View solution in original post

v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

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

 

Table:

d1.png

 

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:

d3.png

 

Best Regards

Allan

 

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

 

View solution in original post

7 REPLIES 7
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

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

 

Table:

d1.png

 

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:

d3.png

 

Best Regards

Allan

 

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

 

ziying35
Impactful Individual
Impactful Individual

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

Anonymous
Not 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
Impactful Individual

Lowercase M means minutes

ziying35
Impactful Individual
Impactful Individual

@Anonymous 

Power Query:

Date.ToText([NextGateDate], "yyyyMM")

Greg_Deckler
Super User
Super User

@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:

 

Greg_Deckler_0-1595626699306.png

 


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
edhans
Super User
Super User

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



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors
Top Kudoed Authors