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

Shape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.

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.

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.