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
yllecna
New Member

Transform Date from DD.MM.YYYY to DD/MM/YYYY gives some errors with blank

Dear all,

 

I would to share a problem I have when importing data with dates.

 

Indeed, I have to transform DD.MM.YYYY to DD/MM/YYYY. I do by replacing "." by "/". I could also "detect automatically". But the result (the error) is the same.

 

When I do so, main rows are ok but some get errors. When I look closer to those with errors, it appears some blanks have been added at the beginning of the date.

 

For instance "28.06.2015" is transformed into "    28/06/2016" with four blanks at the beginning:

 

Blank in date format.JPG

 

Thank you for your help.

 

3 REPLIES 3
MFelix
Super User
Super User

Hi @yllecna,

 

For any change on those specific rows don't you have some spaces also?

 

Before changing the . to / change space to nothing and then do the dot replacement.

 

Regards,

MFelix


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Hello MFelix,

 

Thanks for your answer.

 

Indeed, I thought there was an issue from my source.

 

I checked it but actually no. When my rows are in DD.MM.YYYY format, there is no blank at the beginning.

 

It's really when I convert them to DD/MM/YYYY, it appears to have four blank (space) caracters at the beginning for some rows, not all.

 

I would add also, I get my data from a folder and file in .txt

 

Thanks

 

Hi @yllecna

I can reproduce your problem.

Why this error occurs is that power bi recognizes date format as mm/dd/yy by default instead of dd/mm/yy, indeed  there is no date format as dd/mm/yy automatically, you need to recreate this.

 

If it doesn’t mind transforming it out of Edit queries, You could follow steps below to display date column in DD/MM/YYYY format, and sort it correctly.

 

1.in Query editor, transform “.” To “/”, the close&&apply,

2.in the Data view, select this column and transform it to date type

 

4.png

 

3.Use FORMAT function to create a new calculate column in your table

Column = FORMAT('New Text Document'[Column2],"DD/MM/YYYY")

 

4.Select the new calculate column in Data view, then click "Sort by Column" under Modelingtab, and choose your original date column instead of the default column.

 

5.png

 

 

Best Regards

Maggie

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.