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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
Solution Supplier
Solution Supplier

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.