Forum Discussion

Stealth02's avatar
Stealth02
Helper I
3 years ago
Solved

Power Query - Not all "Tables" created equal?

Context: I have gaps in my master data - where I have cost centers in my fact table that are not present in my master data for particular fiscal year - but those cost centers are present in other yea...
  • AlexisOlson's avatar
    AlexisOlson
    3 years ago

    You don't need to do any appending. You can merge and fill up instead.

     

    let
        x=Count,
        Source = Table.FromRows(List.Zip({{1..x},List.Repeat({"2018-19"},x)})&List.Zip({{1..x},List.Repeat({"2019-20"},x)})&List.Zip({{1..x},List.Repeat({"2020-21"},x)}),{"CC","FY"}),
        #"Merged Queries" = Table.NestedJoin(Source, {"CC", "FY"}, Dim_ForSort, {"CC", "FY"}, "Dim_ForSort", JoinKind.LeftOuter),
        #"Expanded Dim_ForSort" = Table.ExpandTableColumn(#"Merged Queries", "Dim_ForSort", {"Dimension Details"}, {"Dimension Details"}),
        #"Sorted Rows" = Table.Buffer(Table.Sort(#"Expanded Dim_ForSort",{{"CC", Order.Ascending}, {"FY", Order.Ascending}})),
        #"Filled Up" = Table.FillUp(#"Sorted Rows",{"Dimension Details"})
    in
        #"Filled Up"