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

View all the Fabric Data Days sessions on demand. View schedule

Reply
Anonymous
Not applicable

Rearrange text in a cell  (unusual date format)

Our system outputs dates in a way I have never seen. 

YYYYMMDD

With no dashes etc.

Screenshot 2024-10-15 122932.png

 

I need help converting these into a traditional American format. 

ie MM-DD-YYYY

My final report will need to be able to filter out dates so this is a must.

 

I am writing a report to make payment proposals easier, as now it requires between 4 and 9 spreadsheets copying and pasting etc. etc. So I will need to be able to pick a specific date in the future and filter those that are after out.

 

 

1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @Anonymous - To convert the date format from YYYYMMDD to the traditional American format MM-DD-YYYY in Power BI

In Power query editor take a custom column use below function:

 

Date.FromText(Text.Middle([Date Column], 5, 2) & "-" & Text.End([Date Column], 2) & "-" & Text.Start([Date Column], 4))

rajendraongole1_0-1729011292817.png

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

4 REPLIES 4
Ahmedx
Super User
Super User

pls try this

 

= Date.FromText([inv date],[Format="yyyyMMdd", Culture="en-US"])
------ or ----
= Date.FromText( Text.From( [inv date]),[Format="yyyyMMdd", Culture="en-US"])

 

Screenshot_1.png

rajendraongole1
Super User
Super User

Hi @Anonymous - To convert the date format from YYYYMMDD to the traditional American format MM-DD-YYYY in Power BI

In Power query editor take a custom column use below function:

 

Date.FromText(Text.Middle([Date Column], 5, 2) & "-" & Text.End([Date Column], 2) & "-" & Text.Start([Date Column], 4))

rajendraongole1_0-1729011292817.png

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Anonymous
Not applicable

ok not to sound daft... but where and how do I enter this?

I am very new and when i tried this i kept getting an error

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMjEwNLBQitWBciwMjZViYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"inv date" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"inv date", type number}}),
    #"Replaced Value" = Table.ReplaceValue(#"Changed Type",each [inv date],each let y = Int64.From([inv date]/10000),m = Int64.From([inv date]/100-y*100),d=[inv date]-m*100-y*10000 in #date(y,m,d),Replacer.ReplaceValue,{"inv date"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Replaced Value",{{"inv date", type date}})
in
    #"Changed Type1"

How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done". Once you examined the code, replace the Source step with your own source.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors