cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NirH_at_BITeam Frequent Visitor
Frequent Visitor

Convert DateTime into Date in Query Editor using M function

Hi,

 

I'm looking for the right function to replace a DateTime to a Date in M.
The challenge is that the DateTime length may vary based on month and day number, so for example I have: 8/5/2017 12:00:00 AM OR 10/21/2019 12:00:00 AM

 

In both cases I need to keep only the date without the time and change it to: "mm/dd/yyyy".

I used the split function but that requires 2-3 steps in query. Not a big deal but I’m after adding a custom column with the right M formula that will get me the right result.

 

Thanks!
NH

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Convert DateTime into Date in Query Editor using M function

Hi,

This should help.

Untitled.png

2 REPLIES 2
Moderator v-qiuyu-msft
Moderator

Re: Convert DateTime into Date in Query Editor using M function

Hi @NirH_at_BITeam

 

You can go to Query Editor, click on the left icon of the column name, then select the Date to change DateTime type to Date type. The corresponding M query uses the Table.TransformColumnTypes() function. 

 

q1.PNG

 

 

Best Regards,
Qiuyun Yu 

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Super User
Super User

Re: Convert DateTime into Date in Query Editor using M function

Hi,

This should help.

Untitled.png

Helpful resources

Announcements
Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

PBI Community Highlights

PBI Community Highlights

Check out what's new in the Power BI Community!

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Kudoed Authors
Users Online
Currently online: 315 members 3,504 guests
Please welcome our newest community members: