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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Date Format

Hello there,

 

short question. I have a date column in a CSV File with that format 01032018 ddmmyyyy

When I change the format from number to date, I just get 30.12.1899 dd.mm.yyyy.

Is there a way to change the Format in M Query or shall I add another column, where I split the number in three parts and put points between them?

 

#"Geänderter Typ1" = Table.TransformColumnTypes(#"Geänderter Typ",{{"Genehmigungsdat", type date}})

 

Looking forward for any hints :).

2 ACCEPTED SOLUTIONS
Greg_Deckler
Super User
Super User

New column:

 

=Text.Combine({Text.Middle(Text.From([Column1], "en-US"), 2, 1), "/", Text.Start(Text.From([Column1], "en-US"), 1), "/", Text.Middle(Text.From([Column1], "en-US"), 3)})

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

View solution in original post

Anonymous
Not applicable

Afer some time I found a very proper Solution. I just changed the type from text to date in the Advanced Query Editor. And now the date is refered as date without any new column in table or caluclation in Editor.

 

Sorry for let you waiting so long.

And thanks v-xulgu-msft and Greg_Deckler...just missed that little mistake I made. Thanks a lot.

View solution in original post

4 REPLIES 4
Greg_Deckler
Super User
Super User

New column:

 

=Text.Combine({Text.Middle(Text.From([Column1], "en-US"), 2, 1), "/", Text.Start(Text.From([Column1], "en-US"), 1), "/", Text.Middle(Text.From([Column1], "en-US"), 3)})

@ 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...
Anonymous
Not applicable

Thanks for your suggestion Greg,

 

I tried to use your example like that:

#"Genehmigungdat" = Text.Combine({Text.Middle(Text.From([Genehmigungsdat], "en-US"), 2, 1), "/", Text.Start(Text.From([Genehmigungsdat], "en-US"), 1), "/", Text.Middle(Text.From([Genehmigungsdat], "en-US"), 3)})

 

but that didn't work out. Maybe I made the wrong placement. I am not that used to M.

By the way, i noticed that there are different lengths like 10102015 or 1102015 (null is missing).

Can your suggestion handle that aswell?

 

Bild.PNG

Hi @Anonymous,

but that didn't work out. Maybe I made the wrong placement. I am not that used to M.

You should change the last step name once you have added new step in Power code.

1.PNG

 


By the way, i noticed that there are different lengths like 10102015 or 1102015 (null is missing). 

 


Could you provide some examples of date with different length? I have one concern, if the length of dates is not fixed, take 1112015 as an example, should we regard it as 1 November 2015 or 11 January 2015?

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Afer some time I found a very proper Solution. I just changed the type from text to date in the Advanced Query Editor. And now the date is refered as date without any new column in table or caluclation in Editor.

 

Sorry for let you waiting so long.

And thanks v-xulgu-msft and Greg_Deckler...just missed that little mistake I made. Thanks a lot.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.