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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
o59393
Post Prodigy
Post Prodigy

Date format

Hi all

 

How can I convert a date in format "Apr 01 2019" to "April 2019" for example and using power query?

 

https://1drv.ms/u/s!ApgeWwGTKtFdhjOrLr9_z4xQWZca?e=KpC6mb 

 

Thanks.

 

 

 

1 ACCEPTED SOLUTION

@o59393 ,

You have to go to Transform Data/Edit Query and use the Custom Column option.

In Dax , you can try like

 format(DATEVALUE("Apr 01 2019"),"MMMM-YYYY")

 

If it a static value you can use in measure too. Else in measure use some aggregation.

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

6 REPLIES 6
FrankAT
Community Champion
Community Champion

Hi @o59393,

if you change the date in the desired format with Power Query the result will end up in a string. Sort order is alphabetical.

If you want to keep the date intact format it in model view:

  1. Seelect model view.
  2. Select date field in field list.
  3. See figure. Sort order by calendar.

14-03-_2020_13-00-17.png

 

Regards FrankAT

 

Greg_Deckler
Community Champion
Community Champion

Perhaps:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WciwoUjAwVDAyMLRUitWJVvJKzIPwjQzAfLfUJAUDYwTfqzRHwdAUyo8FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Added Custom Column" = Table.AddColumn(Source, "Custom", each Text.Combine({Date.ToText(Date.From([Column1]), "MMMM"), " ", Date.ToText(Date.From([Column1]), "yyyy")}), type text)
in
    #"Added Custom Column"

 



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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi 

 

Where do I have to paste that?

 

As an added custom column?


Thanks!

 

sorry new to this formula builder.  I am trying yearmonth.  not working

 

yearmonth = FORMAT('vw_datamart_Activities'[dt_start],"YYYYMM")

This is more of the downsteam table

feel free to adjust our dashboard.  AppWorx_Azure

That was the code behind the query. You would create a blank query and then paste that code into Advanced Editor. I think I created that code using Add Column From Examples.

 



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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@o59393 ,

You have to go to Transform Data/Edit Query and use the Custom Column option.

In Dax , you can try like

 format(DATEVALUE("Apr 01 2019"),"MMMM-YYYY")

 

If it a static value you can use in measure too. Else in measure use some aggregation.

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.