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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. 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
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.