Hi
I am trying to test if the Source table is empty before I do the transformations.
My attempt does work I get an error "Expression.Error: The import Changed Type matches no exports. Did you miss a module reference?"
The error has only occurred since I inserted the If then else piece of code.
What do I need to change ?
Thank You
Allister
I am trying to test if the Source table is empty before I do the transformations.
My attempt does work I get an error "Expression.Error: The import Changed Type matches no exports. Did you miss a module reference?"
The error has only occurred since I inserted the If then else piece of code.
What do I need to change ?
Thank You
Allister
Power Query:
let
Source = Excel.CurrentWorkbook(){[Name="t_AccredoBranches"]}[Content],
#"Test If t_AccredoBranches Empty" = if Table.IsEmpty(t_AccredoBranches) then "All values are null" else
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type any}, {"Column3", type any}}),
#"Removed Top Rows" = Table.Skip(#"Changed Type",5),
#"Promoted Headers" = Table.PromoteHeaders(#"Removed Top Rows", [PromoteAllScalars=true]),
#"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"Code", type text}, {"Name", type text}, {"Inactive", type text}}),
#"Uppercased Text" = Table.TransformColumns(#"Changed Type1",{{"Inactive", Text.Upper, type text}}),
#"Added Custom" = Table.AddColumn(#"Uppercased Text", "Custom", each Text.PadStart(Text.From([Code]),4,"0")),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Code"}),
#"Reordered Columns" = Table.ReorderColumns(#"Removed Columns",{"Custom", "Name", "Inactive"}),
#"Renamed Columns" = Table.RenameColumns(#"Reordered Columns",{{"Custom", "Branch Code"}}),
#"Filtered Rows" = Table.SelectRows(#"Renamed Columns", each ([Inactive] = "FALSE")),
#"Added Custom1" = Table.AddColumn(#"Filtered Rows", "Source", each "Existng Branch Codes"),
#"Appended Query" = Table.Combine({#"Added Custom1", #"t_BranchTPKBranchCodes (2)"}),
#"Changed Type2" = Table.TransformColumnTypes(#"Appended Query",{{"Branch Code", type text}, {"Inactive", type text}}),
#"Added Conditional Column" = Table.AddColumn(#"Changed Type2", "Custom", each if [Source] = null then "New TPK Branch Codes" else [Source]),
#"Removed Columns1" = Table.RemoveColumns(#"Added Conditional Column",{"Source"}),
#"Appended Query1" = Table.Combine({#"Removed Columns1", t_UserBranches}),
#"Added Conditional Column1" = Table.AddColumn(#"Appended Query1", "Custom.1", each if [Custom] = null then "User Branches" else [Custom]),
#"Renamed Columns1" = Table.RenameColumns(#"Added Conditional Column1",{{"Custom.1", "Source"}}),
#"Capitalized Each Word" = Table.TransformColumns(#"Renamed Columns1",{{"Source", Text.Proper, type text}}),
#"Sorted Rows1" = Table.Sort(#"Capitalized Each Word",{{"Source", Order.Ascending},{"Branch Code", Order.Ascending}}),
#"Replaced Value" = Table.ReplaceValue(#"Sorted Rows1","Tpk","TPK",Replacer.ReplaceText,{"Source"}),
#"Removed Columns2" = Table.RemoveColumns(#"Replaced Value",{"Custom"}),
#"Filtered Rows1" = Table.SelectRows(#"Removed Columns2", each ([Branch Code] <> null))
in
#"Filtered Rows1"
Last edited: