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

Date format - having excel file date format i.e. 27 January 2020 - need to be 27-01-2020

Importing a excel file to data model in excel.

All dates are like this:

31 January 2020
30 January 2020
2 February 2020
4 February 2020

 

I need in the format dd/mm/yyyy, like 31-01-2020

I am trying to change column format but it is being rejected.

 

Anyone who know what to do?

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

Hi @LarsHansson 

Jimmy801's solution should be helpful.

 

If not, please take advice below:

If you use "English(United States) under System setting->Time &Language->Region,

then use default setting for Power BI->Files->Options and settings->Region,

The date is of mm/dd/yyyy by default, it is hard to get date formated as dd/mm/yyyy.

One workaround is to create a calculated column which is of text format.

Column = FORMAT([Date],"dd-mm-yyyy")

 

As tested, when change the setting to other language, for example, demark, which format for date is dd/mm/yyyy, then you could change the date format as expected.

 

 

Capture6.JPGCapture7.JPG

 

 

Capture8.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
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
v-juanli-msft
Community Support
Community Support

Hi @LarsHansson 

Jimmy801's solution should be helpful.

 

If not, please take advice below:

If you use "English(United States) under System setting->Time &Language->Region,

then use default setting for Power BI->Files->Options and settings->Region,

The date is of mm/dd/yyyy by default, it is hard to get date formated as dd/mm/yyyy.

One workaround is to create a calculated column which is of text format.

Column = FORMAT([Date],"dd-mm-yyyy")

 

As tested, when change the setting to other language, for example, demark, which format for date is dd/mm/yyyy, then you could change the date format as expected.

 

 

Capture6.JPGCapture7.JPG

 

 

Capture8.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Many thanks for all your imputs. Problem is now solved. Amazing how such a "small" thing can cause so much trouble. Much appreciated.

 

Jimmy801
Community Champion
Community Champion

Hello @LarsHansson 

 

try out this solution. this should do the trick

let
	Source = #table
	(
		{"Date"},
		{
			{"31 January 2020"},	{"30 January 2020"},	{"2 February 2020"},	{"4 February 2020"}
		}
	),
	TransformToDate = Table.TransformColumns
	(
		Source,
		{
			{
				"Date",
				each Date.FromText(_,"en-GB"),
				type date
			}
		}
	)
in
	TransformToDate

 

Copy paste this code to the advanced editor to see how the solution works. If this solution fits your need, copy and past a part of it and implement it in your query, or I could create a custom function what makes it easier to apply if you are not used that much to power query.

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

Mariusz
Community Champion
Community Champion

Hi @LarsHansson 

 

Click on Detect Data Type in Transform Ribbon.

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

 

AnkitBI
Solution Sage
Solution Sage

Hi @LarsHansson 

 

Please share what are you trying and what error are you getting?

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