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
Chanleakna123
Post Prodigy
Post Prodigy

Transform date DD.MM.YYYY to DD/MM/YYYY

1.PNG

hi , I wanna transform my DD.MM.YYYY to DD/MM/YYYY , that it would be easier for me to link relationship with other table. 

but i failed to get it , even i click Change Type to "Date " , or i use MCode to transform it , it turns error in some date. 

how to success it ? 

2.PNG

1 ACCEPTED SOLUTION
PattemManohar
Community Champion
Community Champion

@Chanleakna123 You can simply change the column type to "Date"

 

But anyway here is the custom column code you need to use..

 

Date.FromText([DateVal] as text) as date

image.png





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

Proud to be a PBI Community Champion




View solution in original post

13 REPLIES 13
PattemManohar
Community Champion
Community Champion

@Chanleakna123 You can simply change the column type to "Date"

 

But anyway here is the custom column code you need to use..

 

Date.FromText([DateVal] as text) as date

image.png





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

Proud to be a PBI Community Champion




hi @PattemManohar still in the same issue 😞 i tried using your M code , 

while it has a lots of row , i trina clear every format.  

how to settle this ? Do you have any idea ? 

 

1.PNG

@Chanleakna123 Did you tried change the "Prod Date" field to Date data type.

 

Also, please post the same data in copiable format which will help us to replicate your issue.





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

Proud to be a PBI Community Champion




@Chanleakna123 Imported all Date values from the file provided (There are few blank rows, which are ignored)

 

So total 326 rows, the same formula worked nothing changed... Working fine for me...

 

image.png





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

Proud to be a PBI Community Champion




Hi @Patt, really appreciated your quick response . Let me work from side and let u know the result. Big thanks

@PattemManohar not sure why it doesn't work on my table , i change the file to excel , do a lots of thing. 

OMG , 😞

@Chanleakna123 Send me the "M Code" (From "Advanced Editor") you have on the table. 





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

Proud to be a PBI Community Champion




let
Source = Excel.Workbook(File.Contents("C:\Users\hchanleakna\Desktop\Power BI\22-Syrup Yield\Monthly Syrup Yield Reporting.xlsx"), null, true),
Sheet2_Sheet = Source{[Item="Sheet2",Kind="Sheet"]}[Data],
#"Changed Type" = Table.TransformColumnTypes(Sheet2_Sheet,{{"Column1", type text}}),
#"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
#"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"Date", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type1", "Custom", each Date.FromText([Date] as text) as date)
in
#"Added Custom"

 

HI @PattemManohar

@Chanleakna123 Could you please confirm that you are using the same excel file that was shared in google drive ? As I can see only one sheet in the excel that was shared.

 

image.png





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

Proud to be a PBI Community Champion




@Patt , this one no use . As I remove in BI . And I will use only Prod Date onward.

@Chanleakna123 But this is the excel file you have provided and I have used Prod Date column from this file only.




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

Proud to be a PBI Community Champion




@PattemManohar hi , i changed another source of the file , and it works , thanks you so much. 

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.