+ Reply to Thread
Results 1 to 8 of 8

Power query Date Table function

  1. #1
    Forum Contributor
    Join Date
    08-03-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    611

    Power query Date Table function

    I've beeb trying to write a date function for power query I've got as far as ;

    Please Login or Register  to view this content.
    Which works but I'm stuck at two things, one I thought I should be able to define the function as a table ;
    Please Login or Register  to view this content.
    but can't get it to work I've tried nestign let / in statements but not got it right.

    Also I'd lke to add more columns, for year , month etc. but keep getting errors, I've tried ;
    Please Login or Register  to view this content.
    I've tried wrapping the whole thing in Table.AddColumn, but this didn't work and would be very impractical for adding lots of columns,
    I've attached workbook showing errors and would like some help on how to write this.

    Richard.
    Attached Files Attached Files

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Power query Date Table function

    You can do something like this - expand as needed:

    Please Login or Register  to view this content.
    Rory

  3. #3
    Forum Contributor
    Join Date
    08-03-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    611

    Re: Power query Date Table function

    Thanks,
    that is what I was trying to do, and you've given me some functions to look into; Tablel.fromcolumns, which I'm guessing reverses table to columns.
    I find nesting let / in statements confusing, I never know where to use; let/ in then another let, in, and where; let / let / in /in, if that makes any sense.
    Richard
    Last edited by Dicken; 11-10-2022 at 09:01 AM. Reason: need to add something.

  4. #4
    Forum Contributor
    Join Date
    08-03-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    611

    Re: Power query Date Table function

    I'm not gettig back column for 'names' of day, I've use the follwing;


    Please Login or Register  to view this content.
    It's the day and month names wich aren't coming through, both work fine in addcolumns, on the 'invoked table',

    any ideas as to why this should be, I did get day name to work on it's own, just adding one column to what you
    gave me, I've attached the workbook with the above code and the added custom column.

    Richard
    Attached Files Attached Files

  5. #5
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Power query Date Table function

    Please Login or Register  to view this content.
    does that give you a clue?

  6. #6
    Forum Contributor
    Join Date
    08-03-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    611

    Re: Power query Date Table function

    Ooops.

    I did get it working, I typed it up in notepad and then pasted it in, I often find that easier.

    BTW what breed is the dog in the photo? I thought a Lab but not sure.

    R

  7. #7
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Power query Date Table function

    Yes, he's a Lab - just quite muddy when that photo was taken (he looked a lot like a hyena by the end of the walk)!

  8. #8
    Forum Contributor
    Join Date
    08-03-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    611

    Re: Power query Date Table function

    Well looks a lovely dog, I'm biased toward labs,

    Thanks for introducing Table.FromColumns, I made the mistake of using double {{}} around the whole thing at first, which returns a list of dates in column1, and the word date in column2.

    then scrolled down a bit further in MS Docs, still at least if I ever need a list of date.........

    Richard

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 10-05-2022, 01:07 AM
  2. [SOLVED] Trying to create Date Table in power query using M
    By Dicken in forum Office 365
    Replies: 3
    Last Post: 11-11-2021, 10:21 AM
  3. [SOLVED] merge table into power query and keep greater date
    By Undo in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 09-18-2021, 09:36 AM
  4. POWER Query and Power Pivot Table !!
    By haitham.shop in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 08-06-2018, 04:09 PM
  5. Power Query and Power Pivot Table
    By haitham.shop in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 08-06-2018, 06:17 AM
  6. Power Query and Power Pivot Table !!
    By haitham.shop in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-06-2018, 06:15 AM
  7. Replies: 3
    Last Post: 12-03-2017, 01:41 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1