Bird
0
0

What will be the result of this Power Query M code?

medium📝 dax lod result Q5 of 15
Power BI - Power Query Editor
What will be the result of this Power Query M code?
let
  Source = Table.FromRecords({[Product="Pen", Price=1],[Product="Pencil", Price=0.5]}),
  Replaced = Table.ReplaceValue(Source, 0.5, 0.75, Replacer.ReplaceValue, {"Price"})
in
  Replaced
APrice for Pencil changes to 0.75
BPrice for Pen changes to 0.75
CNo change in prices
DError due to wrong replacer function
Step-by-Step Solution
Solution:
  1. Step 1: Identify the value to replace and the replacer function

    The code replaces 0.5 with 0.75 in the Price column using Replacer.ReplaceValue.
  2. Step 2: Check which row has Price 0.5

    Pencil has Price 0.5, so it will be updated to 0.75.
  3. Final Answer:

    Price for Pencil changes to 0.75 -> Option A
  4. Quick Check:

    ReplaceValue updates numeric values correctly [OK]
Quick Trick: Use Replacer.ReplaceValue for numeric replacements [OK]
Common Mistakes:
  • Using Replacer.ReplaceText for numbers
  • Expecting Pen's price to change
  • Thinking no change occurs

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Power BI Quizzes