PL-300 Prepare the data Practice Question
Exhibit
Refer to the exhibit. The following Power Query M function is defined:
(value as any) as nullable number =>
try Number.From(Text.Replace(Text.Clean(value), " ", ""))
otherwise nullYou are cleaning a column that contains numbers stored as text, with occasional leading/trailing spaces and currency symbols. You apply the function above to the column. However, some rows return null even though the original text appears to be a valid number, such as '$ 1,234.56'. What is the most likely cause?
⚠ Common exam trap
Candidates may assume that error handling will fix conversion failures, but error handling only catches the error after parsing fails. The input must be pre-processed to remove non-numeric characters before conversion.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
The function does not remove commas and currency symbols before conversion.
Conversion functions like Number.FromText do not automatically strip currency symbols, commas, or spaces. The input '$ 1,234.56' must be cleaned (e.g., remove $, spaces, and commas) before conversion, or the conversion fails and returns null. The error handling (if any) only catches the error; it does not sanitize the input.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The try...otherwise block is not catching parsing errors.
Why it's wrong here
The try...otherwise block is catching the error correctly and returning null as designed. The root cause is not error handling; instead, the function fails to cleanse the input of characters like commas and '$' that Number.From cannot parse. Because the try-otherwise masks the failure by yielding null, it may appear broken, but it is functioning as coded. The real defect lies in the incomplete transformation pipeline prior to conversion.
- ✗
Text.Clean removes necessary decimal separators.
Why it's wrong here
Text.Clean is designed to strip only non-printable control characters, such as carriage returns and tabs, not printable punctuation like decimal separators. Decimal separators (e.g., '.' or ',') are considered printable and are preserved by Text.Clean. Thus the failure is not due to removed decimal points; it is caused by unsanitized currency symbols and thousands separators that remain in the text. This option mistakenly attributes the conversion failure to a side effect that Text.Clean does not perform.
- ✗
The function is applied to the wrong data type column.
Why it's wrong here
The column is already of type text, and the custom function explicitly expects a text argument, so the data types align correctly. Applying the function to a different column would not address the core problem; even a text column can contain values that Number.From rejects (e.g., '$1,200'). The issue is the content of the cell, not the column's declared type or the function's input type. Therefore, blaming a type mismatch is inaccurate; the transformation logic itself is incomplete.
- ✓
The function does not remove commas and currency symbols before conversion.
Why this is correct
The custom function uses Text.Trim and Text.Clean, which remove leading/trailing whitespace and non-printable characters only—they do not eliminate commas or currency symbols. When Number.From encounters a string like '$1,200', it raises an error because those characters are not part of a valid numeric literal in the default culture. The try-otherwise then returns null, so these unrecognized characters remain the true cause of the conversion failure. To fix it, you must strip commas and symbols (e.g., Text.Replace or Text.Remove) before invoking Number.From.
Go deeper
Related to this question
About these practice questions
This PL-300 question is part of Courseiva's 524-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This PL-300 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PL-300 exam.