Forum Discussion

jct999's avatar
jct999
Advocate II
5 years ago

Iterator over a table.

Hi,

I have a table with 4 columns and a few rows.

I want to iterate over this table and pass each row to a personal function. This personal function simply creates a table using the parameters (i.e, the values contained in the passed row).
Then, at the end, I want all tables created during iterations to be combined.

How can I do this iteration easily in M?

Regards

5 Replies

  • Hi jct999 ,

     

    You need to create a custom function and then when you expand the final result you get the table you need.

     

    Can you please share a mockup data or sample of your PBIX file and expected result. You can use a onedrive, google drive, we transfer or similar link to upload your files.


    • jct999's avatar
      jct999
      Advocate II

      Thanks for your answer but it is not clear for me.


      The table I want to iterate has 4 columns :
      - FILE_NAME
      - YEAR
      - MONTH
      - AUTHOR_ID


      My personnal function just loads the file FILE_NAME in a table and add 3 columns to this table : YEAR, MONTH dans AUTHOD_ID.
      Then, at the end, I want to combine all the table loaded in one table.


      I can't send you my model nor PBix file... Could you show me an exemple.

      Regards

       

       

      • jct999's avatar
        jct999
        Advocate II

        Thanks for your reply, but it is not clear to me.

        The table I want to iterate has 4 columns:
        - FILE_NAME
        - Year
        - MONTH
        - AUTHOR_ID

        My personal function just loads the FILE_NAME file into a table and add 3 columns to this table: YEAR, MONTH dans AUTHOD_ID.
        Then at the end I want to merge all the loaded table into one table.

        I can't send you my model or the PBix file ... Could you show me an example.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi jct999 ,

    Not very clearly....But it seems like you want to filter the table by parameter and then append all filtered table ,right?

    Please take a look at the pbix file here.

     

    Did I answer your question ? Please mark my reply as solution. Thank you very much.
    If not, please upload some insensitive data samples and expected output.

     

    Best regards,

    Eyelyn Qin