Bird
0
0

Consider this Power Query M code intended to replace "TX" with "Texas" in the "Region" column:

medium📝 Formula Fix Q7 of 15
Power BI - Power Query Editor
Consider this Power Query M code intended to replace "TX" with "Texas" in the "Region" column:
Table.ReplaceValue(Source, "TX", "Texas", Replacer.ReplaceText, "Region")

Why does this code produce an error?
ABecause the column name must be provided as a list, e.g., {"Region"}
BBecause Replacer.ReplaceText cannot be used for text replacements
CBecause the old value "TX" is case sensitive and does not match
DBecause the function requires an additional parameter for data type
Step-by-Step Solution
Solution:
  1. Step 1: Identify the error cause

    The error arises because the column parameter is passed as a string instead of a list.
  2. Step 2: Correct usage

    The column argument must be a list of column names, e.g., {"Region"}.
  3. Final Answer:

    Because the column name must be provided as a list, e.g., {"Region"} -> Option A
  4. Quick Check:

    Column names must be in a list [OK]
Quick Trick: Column names always need braces in ReplaceValue [OK]
Common Mistakes:
  • Passing column name as string instead of list
  • Misunderstanding Replacer.ReplaceText usage
  • Assuming case sensitivity causes error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Power BI Quizzes