cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ovetteabejuela
Impactful Individual
Impactful Individual

Help on Date Format conversion

I have 2 Excel files with a Source that has this Column 'Date' (see below) in my 1 Excel it converts fine but in the other it converts it to Month as Date and Date as month see other image below.

 

ovetteabejuela_0-1619101038653.png

This should be March 1, April 1, May 1 and not January 3, 4, 5 ...

ovetteabejuela_1-1619101153223.png

 

 

9 REPLIES 9
watkinnc
Super User
Super User

Have you tried Table.AddColumn(Date.FromText([DATE]))

 

Date.FromText, instead of ToText?


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!
V-pazhen-msft
Community Support
Community Support

@ovetteabejuela 

Date
8/1/2021
9/1/2021
10/1/2021


With the above sample date column in excel, I get the correct date with either excel connector and enter date feature in Power Query. I cannot reproduce the 1/4/2021 format in the PQ, that turns the April 1st to Jan 4th. 

V-pazhen-msft_0-1619489019758.png

V-pazhen-msft_1-1619489091159.png

 

 

Please try with Power Query in power bi desktop. This problem could be the Excel Power Query.

 

 


Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

V-pazhen-msft
Community Support
Community Support

@ovetteabejuela 

What is the date format in the original excel file, are both date columns are the same data type and format? Can you show a screen short.

 

Paul Zheng _ Community Support Team

In Excel this is in General Type, and it is basically of type Text

 

Actual Source Screenshot:

ovetteabejuela_5-1619450925582.png

 

Below, I am showing you how it is translated within Excel environment  and into Power Query.

 

ovetteabejuela_4-1619450876801.png

 

 

watkinnc
Super User
Super User

You need to convert the Date Column to Date format before doing Date.ToText. Right now it looks like you are performing a Date Operation on a text column. 
--Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!

Actually that is the very first thing that anyone will do even the system will automatically convert your data after you promote to Headers BUT converting this to date will yeild the same result that is why what your seeing are non-convetional approach.

Converting immediately (as usual) to date will result to January 3, January 4, January 5..... instead of March 1, April 1 and May 1

ovetteabejuela
Impactful Individual
Impactful Individual

By the way I already tried using Locale but it too doesn't work my currect solution is not advisable because if the source will change it's format it will not work... Basically I split this by delimeter and added a custom column with this syntax #date() - this worked but again it's not flexible.

 

I just can't understand why it worked in another Excel (this was older but the same source) and did not work in my version today.

 

@ovetteabejuela , you may want to try,

Table.AddColumn(Source, "Custom", each Date.ToText(Date.From([Date]), "MMMM d, yyyy"))

Screenshot 2021-04-22 173208.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is beyond their comprehension!

DAX is simple, but NOT EASY!

Unfortunately...

 

ovetteabejuela_0-1619191943513.png

 

and my Regional settings is fine:

 

ovetteabejuela_1-1619192006114.png

 

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.

Top Solution Authors
Top Kudoed Authors