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
batmanadk
Helper I
Helper I

Datatype format

Hello! I have downloaded a file that has the dates formated as DD/MM/YYYY, the thing is, that when getting te data to PBID and trying to transform it in the PQuery, I can't format the table as a date column. 

I've tried changing the regional settings to spanish but nothing changed. What I want to achieve is formatting the column "Fecha" as a date column (formatted as a text column currently). I get errors in the column right now, because it is trying to format the column as MM/DD/YYYY, as you can see in the picture below... I haven't found a button to format a date with dates or months in the beggining (in the powerquery). Any ideas?? Thanks a lot. Here is the picture:

Query.jpg

 

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @batmanadk 

 

Based on your description, I created data to reproduce your scenario. The date column's data type is set as text.

 

The pbix file is attached in the end.

Table:

g1.png

 

When you modify the data type as 'date', the error appears because the format of the input data doesn't match the format which is used to parse data. 

g2.png

 

I'd like to suggest you fill the third parameter of 'Table.TransformColumnTypes()' with 'ar-DZ' as the culture.

=Table.TransformColumnTypes(Source,{{"Date", type date}},"ar-DZ")

 

Finally it works properly.

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

5 REPLIES 5
Pragati11
Super User
Super User

Hi @batmanadk ,

 

Try chnaging date formation "Using Locale" for your date column.

Refer following article on how to do this:

https://radacad.com/flawless-date-conversion-in-power-query

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

v-alq-msft
Community Support
Community Support

Hi, @batmanadk 

 

Based on your description, I created data to reproduce your scenario. The date column's data type is set as text.

 

The pbix file is attached in the end.

Table:

g1.png

 

When you modify the data type as 'date', the error appears because the format of the input data doesn't match the format which is used to parse data. 

g2.png

 

I'd like to suggest you fill the third parameter of 'Table.TransformColumnTypes()' with 'ar-DZ' as the culture.

=Table.TransformColumnTypes(Source,{{"Date", type date}},"ar-DZ")

 

Finally it works properly.

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

 

Hi @v-alq-msft , finally your solution worked perfectly. The other suggestions kept the column as text type, and even if I changed locale, I couldn´t make it work with date formulas like DATEDIFF and TODAY. So thanks!

mahoneypat
Employee
Employee

You can change to the data type "Using Locale" to get around this error.  Please see this link for details - https://www.oraylis.de/blog/local-date-formats-in-power-bi#:~:text=Here%20comes%20the%20easy%20way,s...

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


I'm almost sure that I tried that before posting and it didn't work. Any way, just tried it again and it got solved. Thanks

 

*Edit: Reason why it wasn't working before came up later (I just didn't realize it atm). The problem is that even using locale, the column appeared as a text type column and problems like connecting to a date lookup table or using dates with dax would have been impossible if the locale format would've remained. Thanks anyway, for your time and everything.

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.

Top Solution Authors
Top Kudoed Authors