cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
ahuh02 Regular Visitor
Regular Visitor

take substring and formate date in dax

I have a timestamp in powerbi in UK format (dd/mm/yyyy hh:mm:ss). 

 

I want to extract only the date in dd/mm/yyyy format. In DAX I used LEFT:

 

LEFT(column,10)

 

But it changed to mm/dd/yyyy format.

 

I tried 

 

FORMAT(LEFT(column,10),"dd/MM/yyyy"), but still have results in US format.

 

Picture1.png

 

I tried https://community.powerbi.com/t5/Desktop/Format-Date-and-Time/m-p/248416#M110162 and https://community.powerbi.com/t5/Desktop/Date-Format/m-p/120348/highlight/true#M50858 to no avail

 

Any suggestions are most welcome

2 ACCEPTED SOLUTIONS

Accepted Solutions
Community Support Team
Community Support Team

Re: take substring and formate date in dax

Hi @ahuh02,

 

To create a calcualted column using the formula.

 

Column 3 = FORMAT('Table1'[date],"dd") &"/"&FORMAT('Table1'[date],"mm") & "/"& FORMAT('Table1'[date],"yyyy")

Capture.PNG

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Super User
Super User

Re: take substring and formate date in dax

Hi,

 

Does this work?

 

  1.  In the Query Editor, split the column into Date and Time
  2.  Right click on the Date column and go to Change Type > Locale > Date > Engligh (India) > OK
4 REPLIES 4
Gokul Member
Member

Re: take substring and formate date in dax

Add custom column like "Column 2 = 'Query'[date].[Date]" and change the data type to date and format under modelling tab or directly you can proceed with format under modelling
Community Support Team
Community Support Team

Re: take substring and formate date in dax

Hi @ahuh02,

 

To create a calcualted column using the formula.

 

Column 3 = FORMAT('Table1'[date],"dd") &"/"&FORMAT('Table1'[date],"mm") & "/"& FORMAT('Table1'[date],"yyyy")

Capture.PNG

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Super User
Super User

Re: take substring and formate date in dax

Hi,

 

Does this work?

 

  1.  In the Query Editor, split the column into Date and Time
  2.  Right click on the Date column and go to Change Type > Locale > Date > Engligh (India) > OK
Community Support Team
Community Support Team

Re: take substring and formate date in dax

Hi @ahuh02,

 

Does that make sense? If so, kindly mark my answer as the solution to close the case please. Thanks in advance.

 

Regards,
Frank

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