Force type as date in creation of column

Hi there,

From the query expression which I wrote below, I would expect my column to automatically be of type Date. However, it is of type “ABC 123”. Is there a way to change my customer column so thattype Date is enforced without me having to go and add a second step and converting it myself?

Thank you

Hi @michellepace. The easiest way might be to just add a new step to change the type.

#“Changed Type1” = Table.TransformColumnTypes(#“Duplicated Column”,{{“Period”, type date}})

I’m sure those experienced in PQ could do it inside your existing step, perhaps by appending “, type date” to your existing code …

Hope this helps.

Hi @michellepace,

You can’t declare type in the add custom column dialog box
BUT once you’ve pressed OK you can add this in the formula bar:

, type date

before the closing parenthesis of the Table.AddColumn function

I hope this is helpful.


Thank you Melissa, that works perfectly. If I wanted to convert it to an integer rather… is my only option to use

, type number


No for a whole number it’s:

, Int64.Type

Note that in this case you omit the “type” in front so this is not valid: , type Int64.Type

Ps. if you are not sure of the type, just add a change type step, look inside the formula bar what type was assigned. Remove the change type step again and add it to the previous step :+1: