+ Reply to Thread
Results 1 to 11 of 11

Power Query custom function variable to make table a list

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

    Power Query custom function variable to make table a list

    I have the folloing custom function, but the last part [Units] I would like to put as a variable ,


    Please Login or Register  to view this content.
    Just trying to add it 'toList' as text and then adding it directly does not work nor does TableColumn ,

    Please Login or Register  to view this content.
    Is there a way I can not have this part hardcoded. Attached workbook with several attempts.

    Richard.
    Attached Files Attached Files
    Last edited by Dicken; 07-08-2023 at 05:36 AM. Reason: Update attachment

  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 custom function variable to make table a list

    I think you meant:

    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
    613

    Re: Power Query custom function variable to make table a list

    Well sought of in that I'ts fine as far as syntax errors go but it doesn't work?

    I have this wherer I've created the Units variable, but left it hardcoded ;

    Please Login or Register  to view this content.
    Which works, but as soon as I try to introduced the 'mylist' to replace [Units] I get an error. I don't think it likes the comma, and table.column
    is the only way I can think of around it but that don't work either.

  4. #4
    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 custom function variable to make table a list

    In what way does what I posted not work?

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

    Re: Power Query custom function variable to make table a list

    This is strange;
    I pasted yours into notepad with mine below and went through it, having just tried mine and got an error ;

    Rory;
    Please Login or Register  to view this content.
    So I deleted mine and pasted yours into the the editor tried it and it worked, so started again and made new function from scratch,
    and still get the same error, 'cannot convert table to list', any ideas, I'll replace workbook with one showing both your working and mine.

    Richard.

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

    Re: Power Query custom function variable to make table a list

    Just to add add named your rory an my not working mine.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Power Query custom function variable to make table a list

    What does that mean?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  8. #8
    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 custom function variable to make table a list

    Yours is missing Table.Column( before the Table.SelectRows

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

    Re: Power Query custom function variable to make table a list

    to Ali, sorry missed an 's I named rory's verson after him to distinguish form what I had done.

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

    Re: Power Query custom function variable to make table a list

    Thank you,
    Right I'm going to have to experiment with that, I really thought I'd compared them both, now I've looked at it I almost see why it's needed, almost,
    RD

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

    Re: Power Query custom function variable to make table a list

    Sorry can't spell, meant yours as in I'd named Rory's after him.

+ 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. How to update a custom function in Power Query
    By MangoFresh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-10-2023, 08:58 AM
  2. Power Query Custom function for running total
    By Dicken in forum Office 365
    Replies: 6
    Last Post: 10-29-2022, 10:58 AM
  3. Power query Custom function / parameter query
    By Dicken in forum Office 365
    Replies: 0
    Last Post: 03-23-2022, 10:41 AM
  4. Replies: 1
    Last Post: 02-14-2022, 06:23 AM
  5. Power Query - Date List with changing variable
    By Steveapa in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-17-2020, 12:27 PM
  6. Add custom fields to a table to simulate a pivot table - Power Query
    By nathalielesperance in forum Excel General
    Replies: 2
    Last Post: 10-25-2018, 06:44 AM
  7. Power Query - Invoke Custom Function
    By leukep in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-12-2017, 02:18 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