i have two table to merge and then i expand newcolumns. the problem is the first table can have new columns as we enter new data to a new month/year. the result does not include these new months.
is there a way to manage to expand new columns while merging ?
the queries :
let
Source = #"320 Odemeler",
#"Merged Queries" = Table.NestedJoin(Source,{"HESAP NO"},#"320 Faturalar",{"HESAP NO"},"NewColumn",JoinKind.LeftOuter),
#"Expanded NewColumn" = Table.ExpandTableColumn(#"Merged Queries", "NewColumn", {"HESAP NO", "HESAP ADI", "Nisan - 2016", "Haziran - 2016", "Temmuz - 2016", "Ağustos - 2016", "Eylül - 2016", "Ekim - 2016", "Kasım - 2016", "Aralık - 2016", "Ocak - 2017", "Şubat - 2017", "Mart - 2017", "Mayıs - 2017"}, {"HESAP NO.1", "HESAP ADI.1", "Nisan - 2016", "Haziran - 2016", "Temmuz - 2016", "Ağustos - 2016", "Eylül - 2016", "Ekim - 2016", "Kasım - 2016", "Aralık - 2016", "Ocak - 2017", "Şubat - 2017", "Mart - 2017", "Mayıs - 2017"})
in
#"Expanded NewColumn"
the other query :
let
Source = #"Tum Hareketler",
#"Sorted Rows" = Table.Sort(Source,{{"DATE_", Order.Ascending}}),
#"Duplicated Column" = Table.DuplicateColumn(#"Sorted Rows", "DATE_", "DATE_ - Copy"),
#"Extracted Month Name" = Table.TransformColumns(#"Duplicated Column", {{"DATE_", each Date.MonthName(_, "tr-TR"), type text}}),
#"Extracted Year" = Table.TransformColumns(#"Extracted Month Name",{{"DATE_ - Copy", Date.Year}}),
#"Added Custom" = Table.AddColumn(#"Extracted Year", "Tarih", each [DATE_] & " - " & Number.ToText([#"DATE_ - Copy"], "G","")),
#"Grouped Rows" = Table.Group(#"Added Custom", {"HESAP NO", "HESAP ADI", "Tarih"}, {{"Sum Alacak", each List.Sum([ALACAK]), type number}}),
#"Pivoted Column" = Table.Pivot(#"Grouped Rows", List.Distinct(#"Grouped Rows"[Tarih]), "Tarih", "Sum Alacak", List.Sum)
in
#"Pivoted Column"
{"HESAP NO", "HESAP ADI", "Nisan - 2016", "Haziran - 2016", "Temmuz - 2016", "Ağustos - 2016", "Eylül - 2016", "Ekim - 2016", "Kasım - 2016", "Aralık - 2016", "Ocak - 2017", "Şubat - 2017", "Mart - 2017", "Mayıs - 2017"}
as list... – Umut KSource = Tarih
and then what should i write into theTable.ExpandTableColumn
? – Umut K