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, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
ChemEnger
Advocate IV
Advocate IV

Table.DuplicateColumn ColumnType ignored

I have used a Table.DuplicateColumn command to create a copy of a datetime column (Start DateTime), including specifying the type as date:

#"Duplicated Start DateTime" = Table.DuplicateColumn(#"Previous Step", "Start DateTime", "Start Date", type date)

My question / issue is that the ColumnType option seems to be ignored and the new column appears as datetime (although the 'icon' is date), which I then have to change in another step.

Original columns:

ChemEnger_0-1724921017733.png

New Column:

ChemEnger_1-1724921031438.png

 

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

Might be just a cosmetic issue, similar to what we had for the longest time with Table.AddColumn *

 

Note: Specifying a Date column type is futile as Power BI doesn't actually have such a data type.  In Power BI everything is datetime behind the scenes.

 

* on second thought you can replace Table.DuplicateColumn with Table.AddColumn.

View solution in original post

3 REPLIES 3
lbendlin
Super User
Super User

Might be just a cosmetic issue, similar to what we had for the longest time with Table.AddColumn *

 

Note: Specifying a Date column type is futile as Power BI doesn't actually have such a data type.  In Power BI everything is datetime behind the scenes.

 

* on second thought you can replace Table.DuplicateColumn with Table.AddColumn.

Table.AddColumn(#"Previous Step", "Start Date", each Date.From([Start DateTime]), type date)
Did the job equally as well - in which case, what's the benefit of DuplicateColumn and the (optional) ColumnType?!

It's what we call "syntax sugar" - a convenience function that is equivalent (or should be) to a more atomic function.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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