Else condition missing in your logic. I have added null for your example purpose and you can change as per your requirement.
Let me know if its help ?
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Salary", Int64.Type}}),
#"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type", "Name", Splitter.SplitTextByDelimiter(" ", QuoteStyle.Csv), {"Name.1", "Name.2"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Name.1", type text}, {"Name.2", type text}}),
result =
if param1 = "Update"
then #"Changed Type1" **else null**
in
#"result"
Thank you for that - I have updated theCode but now I get an error. If theparam1 i<> “Update” I don’t want the table to change and I don’t want an error. is there an error Handling piece of code i need to use ? IfThen.xlsx (19.1 KB)
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Salary", Int64.Type}}),
#"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type", "Name", Splitter.SplitTextByDelimiter(" ", QuoteStyle.Csv), {"Name.1", "Name.2"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Name.1", type text}, {"Name.2", type text}}),
result =
if param1 = "Update"
then #"Changed Type1" else Source
in
#"result"
Hi
Thank You again. However I did not explain my self eth best.
The Query loads to a table in teh workbook. if the para1 <> Update then I want the table that the Query loads to to remain unchanged. If the para1 = Update then the Query needs to Load to the table.
Having the else Source means that the Source Table to will load to the tableTable unaffected by teh Query code
I think I just need a way to avid eth error… or perhaps there’s another way.