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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
ompraashkumawat
Frequent Visitor

Date Fomat

I want custom column formula for changing date format 7/28/2023 9:10:02 AM to 2023-7-28 9:10:02 in poewrbi Desktop. How can  I achieve this and the data is in Direct Query Mode.

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

Hi @ompraashkumawat ,

 

As far as I know, calculated column by FORMAT function will return a column in text data type instead of date data type.

I suggest you to add a custom format in model view.

Select the column and change the format as below.

yyyy-mm-dd hh:mm:ss AM/PM

vrzhoumsft_0-1690787547735.png

Result is as below.

vrzhoumsft_1-1690787659246.png

 

Best Regards,
Rico Zhou

 

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

7 REPLIES 7
v-rzhou-msft
Community Support
Community Support

Hi @ompraashkumawat ,

 

As far as I know, calculated column by FORMAT function will return a column in text data type instead of date data type.

I suggest you to add a custom format in model view.

Select the column and change the format as below.

yyyy-mm-dd hh:mm:ss AM/PM

vrzhoumsft_0-1690787547735.png

Result is as below.

vrzhoumsft_1-1690787659246.png

 

Best Regards,
Rico Zhou

 

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

 

Dhairya
Super User
Super User

Hey @ompraashkumawat 
Please try the below formula to create a calculated column
CalculatedColumn = FORMAT(YourTable[YourDateColumn], "yyyy-mm-dd hh:nn:ss AM/PM")

If this helps you then please mark my solution as accepted so that others can find it quickly on facing similar issues. Thank You!

Ahmedx
Super User
Super User

probably yes!

Ahmedx
Super User
Super User

plse try this

Column = FORMAT([Column1],"yyyy-mm-dd hh:mm:ss")

Screenshot_3.png

Screenshot 2023-07-28 105105.png

I am getting this error. Is it due to Direct Query Mode?

Screenshot 2023-07-28 105105.png

I am getting this error. Is it due to Direct Query Mode?

Hi @ompraashkumawat 

 

Can you change it in Model View?

mlsx4_0-1690526839698.png

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.