let
Source = OData.Feed("api.businesscentral.dynamics.com/.../[ID]/Production/ODataV4/Company('[COMPANY]')/DimensionSetEntries", null, [Implementation="2.0"]), #"Removed Other Columns" = Table.SelectColumns(Source,{"Dimension_Set_ID"}), #"Removed Duplicates" = Table.Distinct(#"Removed Other Columns"), #"Add DEPT" = Table.AddColumn(#"Removed Duplicates", "DEPT", each "DEPT"), #"Merge DEPT" = Table.NestedJoin(#"Add DEPT", {"Dimension_Set_ID", "DEPT"}, DimensionSets, {"Dimension_Set_ID", "Dimension_Code"}, "DimensionSets", JoinKind.LeftOuter), #"Expand DEPT" = Table.ExpandTableColumn(#"Merge DEPT", "DimensionSets", {"Dimension_Value_Code", "Dimension_Value_Name"}, {"DEPT Code", "DEPT Name"}), #"Remove DEPT" = Table.RemoveColumns(#"Expand DEPT",{"DEPT"}), #"Add PROJECT" = Table.AddColumn(#"Remove DEPT", "PROJECT", each "PROJECT"), #"Merge PROJECT" = Table.NestedJoin(#"Add PROJECT", {"Dimension_Set_ID", "PROJECT"}, DimensionSets, {"Dimension_Set_ID", "Dimension_Code"}, "DimensionSets", JoinKind.LeftOuter), #"Expand PROJECT" = Table.ExpandTableColumn(#"Merge PROJECT", "DimensionSets", {"Dimension_Value_Code", "Dimension_Value_Name"}, {"PROJECT Code", "PROJECT Name"}), #"Remove PROJECT" = Table.RemoveColumns(#"Expand PROJECT",{"PROJECT"}), #"Add EVENT" = Table.AddColumn(#"Remove PROJECT", "EVENT", each "EVENT"), #"Merge EVENT" = Table.NestedJoin(#"Add EVENT", {"Dimension_Set_ID", "EVENT"}, DimensionSets, {"Dimension_Set_ID", "Dimension_Code"}, "DimensionSets", JoinKind.LeftOuter), #"Expand EVENT" = Table.ExpandTableColumn(#"Merge EVENT", "DimensionSets", {"Dimension_Value_Code", "Dimension_Value_Name"}, {"EVENT Code", "EVENT Name"}), #"Remove EVENT" = Table.RemoveColumns(#"Expand EVENT",{"EVENT"})
in
#"Remove EVENT"
|