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, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare 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
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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