Trusted Members
October 18, 2018
Receiving the following message: Expression.Error: There is an unknown identifier. Did you use the [field] shorthand for a _[field] outside of an 'each' expression?
This is happening with this line of code: = Text.Replace([Address], [States], " ")
After finding the State in the Address field and placing it in the States Field, I wish to remove it from the Address Field.
File is attached for review.
Power Query
Power Pivot
Xtreme Pivot Tables
Excel for Decision Making
Excel for Finance
Excel Analysis Toolpak
Power BI
Excel
Word
Outlook
Excel Expert
Excel Customer Service
PowerPoint
November 8, 2013
Instead of:
= Table.AddColumn(#"Changed Type", "States", each List.Accumulate(States1, "",
(state,current) =>
if List.Contains(Text.Split([Address]," "),current)
then state & " " & current
else state))
Try:
= Table.AddColumn(#"Changed Type", "States", (x)=> List.Accumulate(States1, "",
(state,current) =>
if List.Contains(Text.Split(x[Address]," "),current)
then state & " " & current
else state))
Trusted Members
Moderators
November 1, 2018
Trusted Members
October 18, 2018
@Catalin. Tried your suggestion but it did not compute. PQ did not accept the line of Mcode. Did not throw an error, but did post some gibberish in the main window.
@Velouria. Your suggestion worked, but it then required that I delete the column with the original Address as it duplicated part of it. I can live with that.
Thank you both for your time on this issue.
Alan
Power Query
Power Pivot
Xtreme Pivot Tables
Excel for Decision Making
Excel for Finance
Excel Analysis Toolpak
Power BI
Excel
Word
Outlook
Excel Expert
Excel Customer Service
PowerPoint
November 8, 2013
1 Guest(s)