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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
badgeming
Frequent Visitor

MySQL - how do I add another column to return the integer of the date

Hi, I have a DateCreated column coming from a MySQL dataset where the values are in dd/mm/yy hh:mm:ss.  I want to create another column that is just dd/mm/yy format without the hh:mm:ss bit (i.e an integer of my DateCreated column).  I have tried going via Edit Queries, selecting the DateCreated column and under add column, date, selecting Date only.  This adds another column with the date only but my whole report disappears and I can't build it from scratch.  Any ideas?

2 ACCEPTED SOLUTIONS
Greg_Deckler
Super User
Super User

So, in DAX, you could create a new column with this formula:

 

Column = INT([Date])

Then, set this to "Date" as a Data Type in the Modeling ribbon.

 

This works because DAX Date/Time is a numeric data type where the integer portion is the number of days from December 30th, 1899 and the decimal portion is the time component.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

Excellent, thank you

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

So, in DAX, you could create a new column with this formula:

 

Column = INT([Date])

Then, set this to "Date" as a Data Type in the Modeling ribbon.

 

This works because DAX Date/Time is a numeric data type where the integer portion is the number of days from December 30th, 1899 and the decimal portion is the time component.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Excellent, thank you

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.