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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Schch
Frequent Visitor

Data Type conversion problem for DATE in Power Query on au.finance.yahoo.com

Hi,

I found that the Data type conversion for Date in Power Query did not work from Sept for the web source :

 https://au.finance.yahoo.com/quote/%5EHSI/history/.

 

Any clue to this

 

Screenshot 2024-09-06 174910.pngScreenshot 2024-09-06 171801.png

1 ACCEPTED SOLUTION
moncx
Resolver II
Resolver II

Hey @Schch ,

 

as @Alex87 said promote first row to headers, you can find how to do that here: Promote or demote rows and column headers (Power Query) - Microsoft Support

 

And then you get error because 'Sept' is not official shortened version of september - it should be 'Sep'. So before you change column type to date add a step and replace 'Sept' to 'Sep' (instructions: Replace values (Power Query) - Microsoft Support) or just use this M code:

= Table.ReplaceValue(#"Changed Type","Sept","Sep",Replacer.ReplaceText,{"Date"})
After that just check if other months use correct short version of the month and if not change it in the same manner before converting to date type.

 

Hope it helps!

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

6 REPLIES 6
moncx
Resolver II
Resolver II

Hey @Schch ,

 

as @Alex87 said promote first row to headers, you can find how to do that here: Promote or demote rows and column headers (Power Query) - Microsoft Support

 

And then you get error because 'Sept' is not official shortened version of september - it should be 'Sep'. So before you change column type to date add a step and replace 'Sept' to 'Sep' (instructions: Replace values (Power Query) - Microsoft Support) or just use this M code:

= Table.ReplaceValue(#"Changed Type","Sept","Sep",Replacer.ReplaceText,{"Date"})
After that just check if other months use correct short version of the month and if not change it in the same manner before converting to date type.

 

Hope it helps!

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

Hello,

May I know why this function;

= Table.AddColumn(#"Added Custom4", "Month Name", each Date.ToText([DateKey],"MMM"))

returns Sept i.s.o. Sep?

Other short month name works perfectly (ie, Jan, Feb, Mar, Apr, May, Jun, July, Aug, Oct, Nov, & Dec)

Schch
Frequent Visitor

Thanks moncx, the step of replace value for Sept with Sep..  it works.

schch

Ritaf1983
Super User
Super User

Hi @Schch 

I wasn't able to connect to the site, so for demonstration purposes, I downloaded your table as a CSV. From there, the steps are: 1. Promote the headers to the top row, and 2. Convert the date field to a local date.

Ritaf1983_0-1725610401974.png

Ritaf1983_1-1725610493580.png

Ritaf1983_2-1725610515598.png

The pbix is attached

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile
PijushRoy
Super User
Super User

Hi @Schch 

1 Please delete the change type step
2. Use the first row as a header option to select Date, Open, High etc as a column header

PijushRoy_0-1725610429459.png

 


3. Set a locale or region for data (Power Query)
Step by step information - https://www.myonlinetraininghub.com/change-type-using-locale-with-power-query

Please let me know if above steps not works




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





Alex87
Solution Sage
Solution Sage

Hello @Sch ,

From what I see your first row needs to be promoted as headers (eg column 1 should be called Date)

In which concerns the date type, try using locale date (right click on column title, change type, using locale, date & locale)




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!




Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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