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
pl456
Regular Visitor

Copying a table change the datatype

Hi, I've found a weird behavior in PBI Desktop :

If I create a new table from scratch with a date column like so :
1.jpg

And I copy this table using DAX :
2.jpg
The newly created table will have the date column type as Date/time instead of Date like the original table :
3.jpg

Is that behaviour by design? Any way around this?

Thanks for the help.

1 ACCEPTED SOLUTION
MartynRamsden
Solution Sage
Solution Sage

Hi @pl456 

 

This isn't a bug but a difference in how dates are handled between DAX and Power BI.

DAX only has the DateTime data type to handle dates. In Power BI, there are two additional data type: Date and Time.

See here for more info: dax.guide/dt/datetime/ 

 

Because you're using DAX to create your new table, the data type is forced to DateTime.

 

Once you've created your new table, you can simply change the data type of the column using the UI in Power BI.

 

Hope this helps.

 

Best regards,
Martyn


If I answered your question, please help others by accepting it as a solution.

View solution in original post

2 REPLIES 2
MartynRamsden
Solution Sage
Solution Sage

Hi @pl456 

 

This isn't a bug but a difference in how dates are handled between DAX and Power BI.

DAX only has the DateTime data type to handle dates. In Power BI, there are two additional data type: Date and Time.

See here for more info: dax.guide/dt/datetime/ 

 

Because you're using DAX to create your new table, the data type is forced to DateTime.

 

Once you've created your new table, you can simply change the data type of the column using the UI in Power BI.

 

Hope this helps.

 

Best regards,
Martyn


If I answered your question, please help others by accepting it as a solution.

That makes a lot of sense. Thanks for the explanation.

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.