My code is like this and I the Custom v column only contains errors. Some of the values in GL Accounts Table.Account Class are null
Code is
let
Source = Table.NestedJoin(#“2019 Accredo Budget Export xlsx”, {“Branch”}, #“Accredo BRANCH Table”, {“Branch Code”}, “Accredo BRANCH Table”, JoinKind.LeftOuter),
#“Expanded Accredo BRANCH Table” = Table.ExpandTableColumn(Source, “Accredo BRANCH Table”, {“Branch Name”, “Inactive”}, {“Accredo BRANCH Table.Branch Name”, “Accredo BRANCH Table.Inactive”}),
#“Merged Queries” = Table.NestedJoin(#“Expanded Accredo BRANCH Table”, {“Department”}, #“Accredo Depts Table”, {“Department Code”}, “Accredo Depts Table”, JoinKind.LeftOuter),
#“Expanded Accredo Depts Table” = Table.ExpandTableColumn(#“Merged Queries”, “Accredo Depts Table”, {“Department Name”, “Inactive”}, {“Accredo Depts Table.Department Name”, “Accredo Depts Table.Inactive”}),
#“Merged Queries1” = Table.NestedJoin(#“Expanded Accredo Depts Table”, {“GL Account”}, #“GL Accounts Table”, {“Account Code”}, “GL Accounts Table”, JoinKind.LeftOuter),
#“Expanded GL Accounts Table” = Table.ExpandTableColumn(#“Merged Queries1”, “GL Accounts Table”, {“Account Name”, “Account Class”, “Account Type”, “Inactive”}, {“GL Accounts Table.Account Name”, “GL Accounts Table.Account Class”, “GL Accounts Table.Account Type”, “GL Accounts Table.Inactive”}),
#“Added Custom” = Table.AddColumn(#“Expanded GL Accounts Table”, “Custom”, each if [GL Accounts Table.Account Class] = “Income” then [6 mths Actuals] *-1 else [6 mths Actuals]),
#“Filtered Rows” = Table.SelectRows(#“Added Custom”, each ([GL Accounts Table.Account Class] = “Expense”)),
Custom = #“Filtered Rows”{4}[Custom]
in
Custom
Error shown is
Expression.Error: The field ‘GL Accounts Table.Account Class’ of the record wasn’t found.
Details:
Budget Rpt Name=Budget Preparation Report 15
Account Code=2018.000
Branch=29
Department=
GL Account=2018
Account Name=Contract Staff
6 mths Actuals=28333.39
6 My ths Budget=49999.98
Thank You