Results 1 to 1 of 1

Thread: PQ - Table.Partition - split single table to three tables by year

  1. #1
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    234
    Rep Power
    7

    Cool PQ - Table.Partition - split single table to three tables by year

    Table.Partition - split single table to three tables by year

    Date Country City Date Country City
    21/03/2018
    Sierra Leone Feldkirchen in Kärnten
    02/08/2017
    Liechtenstein Temuka
    18/04/2018
    Tonga Curacautín
    23/04/2017
    Fiji Monte Patria
    02/08/2017
    Liechtenstein Temuka
    21/05/2017
    Cape Verde Juneau
    19/01/2018
    Kazakhstan Gouvy
    01/06/2018
    Botswana Meerdonk
    23/04/2017
    Fiji Monte Patria Date Country City
    06/04/2019
    Uruguay Moorsel
    21/03/2018
    Sierra Leone Feldkirchen in Kärnten
    21/05/2017
    Cape Verde Juneau
    18/04/2018
    Tonga Curacautín
    06/08/2018
    Nicaragua Cartagena
    19/01/2018
    Kazakhstan Gouvy
    21/03/2018
    Ukraine Oderzo
    01/06/2018
    Botswana Meerdonk
    06/08/2018
    Nicaragua Cartagena
    21/03/2018
    Ukraine Oderzo
    |
    |
    Date Country City
    06/04/2019
    Uruguay Moorsel


    Code:
    // Table1
    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        TP = Table.Partition(Table.AddColumn(Source, "Year", each Date.Year([Date]), Int64.Type), "Year", 3, each _)
    in
        TP
    use Add as New Query for each table from the list

    then load to the sheet

    example of one of the result table

    Code:
    // 2017
    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        TP = Table.Partition(Table.AddColumn(Source, "Year", each Date.Year([Date]), Int64.Type), "Year", 3, each _),
        TP1 = TP{1},
        TypeDate = Table.TransformColumnTypes(Table.RemoveColumns(TP1,{"Year"}),{{"Date", type date}})
    in
        TypeDate

    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNsaS3Lp1
    https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgR1EPUkhw
    https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNe_XC-jK
    https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNPOdiDuv
    https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgN7AC7wAc
    https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgyBACXgNY4j_cHgH5J4AaABAg.9oTkVdzfqfm 9wlhQrYJP3M
    https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgxYgiEZuS9I3xkjJv54AaABAg
    https://www.youtube.com/watch?v=DVFFApHzYVk&lc=Ugyi578yhj9zShmhuPl4AaABAg
    https://www.youtube.com/watch?v=GqzeFYWjTxI&lc=UgxvxlnuTRWiV6MUZB14AaABAg
    https://www.youtube.com/watch?v=_8i1fVEi5WY&lc=Ugz0ptwE5J-2CpX4Lzh4AaABAg
    https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgxoHAw8RwR7VmyVBUt4AaABAg. 9C-br0lEl8V9xI0_6pCaR9
    https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=Ugz5DDCMqmHLeEjUU8t4AaABAg. 9bl7m03Onql9xI-ar3Z0ME
    https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgxYnpd9leriPmc8rPd4AaABAg. 9gdrYDocLIm9xI-2ZpVF-q
    https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgyjoPLjNeIAOMVH_u94AaABAg. 9id_Q3FO8Lp9xHyeYSuv1I
    https://www.reddit.com/r/windowsxp/comments/pexq9q/comment/k81ybvj/?utm_source=reddit&utm_medium=web2x&context=3
    https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgxYgiEZuS9I3xkjJv54AaABAg
    https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgyBACXgNY4j_cHgH5J4AaABAg.9oTkVdzfqfm 9wlhQrYJP3M
    ttps://www.youtube.com/watch?v=LP9fz2DCMBE
    https://www.youtube.com/watch?v=LP9fz2DCMBE&lc=UgzbPgJUMCztIOQDym14AaABAg
    https://www.youtube.com/watch?v=LP9fz2DCMBE&lc=UgzbPgJUMCztIOQDym14AaABAg. 9wdo_rWgxSH9wdpcYqrvp8
    ttps://www.youtube.com/watch?v=bFxnXH4-L1A
    https://www.youtube.com/watch?v=bFxnXH4-L1A&lc=UgxuODisjo6cvom7O-B4AaABAg.9w_AeS3JiK09wdi2XviwLG
    https://www.youtube.com/watch?v=bFxnXH4-L1A&lc=UgxBU39bTptFznDC1PJ4AaABAg
    ttps://www.youtube.com/watch?v=GqzeFYWjTxI
    https://www.youtube.com/watch?v=GqzeFYWjTxI&lc=UgwJnJDJ5JT8hFvibt14AaABAg
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Attached Images Attached Images
    Last edited by DocAElstein; 11-20-2023 at 03:42 PM.
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

Similar Threads

  1. Replies: 0
    Last Post: 05-14-2020, 09:50 PM
  2. Replies: 0
    Last Post: 03-20-2020, 06:36 PM
  3. Append Table data to another table
    By jeremiah_j2k in forum Excel Help
    Replies: 4
    Last Post: 08-10-2017, 09:12 PM
  4. Excluding Records of one Table from the Other Table
    By Transformer in forum Tips, Tricks & Downloads (No Questions)
    Replies: 0
    Last Post: 05-17-2013, 12:32 AM
  5. Replies: 4
    Last Post: 05-01-2013, 09:49 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
  •