Results 1 to 3 of 3

Thread: Adding a Column with current date (not based on another column)

  1. #1
    Neophyte cs566's Avatar
    Join Date
    Jun 2015
    Posts
    2
    Articles
    0
    Excel Version
    2016

    Adding a Column with current date (not based on another column)



    Register for a FREE account, and/
    or Log in to avoid these ads!

    I am wanting to insert a column in one of my source tables in the transform PQ Editor. The column should reflect the date the query is performed. I don't want the date to reflect the date the report is viewed.
    Is there a formula/function that will provide this information.
    I have looked at:
    Column From Examples
    Custom Column
    Invoke Custom Function
    ...but they don't seem to provide what I need.
    I am teaching myself PQ and PP and thought this would be an easy thing to do...
    Any help would be welcomed and appreciated.
    tks/

  2. #2
    Conjurer alansidman's Avatar
    Join Date
    Oct 2018
    Location
    Steamboat Springs
    Posts
    194
    Articles
    0
    Excel Version
    2019
    Code:
        #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each DateTime.LocalNow() as datetime),
        #"Changed Type1" = Table.TransformColumnTypes(#"Added Custom",{{"Custom", type date}})

  3. #3
    Super Moderator Bob Phillips's Avatar
    Join Date
    Mar 2011
    Posts
    1,681
    Articles
    0
    Excel Version
    O365
    Code:
        #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each DateTime.ToText(DateTime.LocalNow(), "dd/MM/yyyy"))
    Last edited by Bob Phillips; 2019-11-01 at 03:34 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •