Thursday, 10 August 2023

P9

 let

    // Load your calendar and iterations tables

    CalendarTable = ...,

    IterationsTable = ...,

    

    // Merge the tables without any key

    CombinedTable = Table.NestedJoin(CalendarTable, {}, IterationsTable, {}, "Merged", JoinKind.LeftOuter),

    

    // Define a custom function to check the condition

    CheckCondition = (row) => row[DateUTC] = row[StartDate],

    

    // Expand the merged table with new columns based on the condition

    ExpandedTable = Table.AddColumn(CombinedTable, "ExpandedColumns", each if CheckCondition(_) then [Column1, Column2, ...] else null),

    

    // Filter out rows where the condition is not met and remove unnecessary columns

    FilteredTable = Table.SelectRows(ExpandedTable, each [ExpandedColumns] <> null),

    FinalTable = Table.RemoveColumns(FilteredTable, {"ExpandedColumns"})


in

    FinalTable

No comments:

Post a Comment