Courseiva

PL-300 Visualize and analyze the data Practice Question

Exhibit

Refer to the exhibit.

Power Query M code snippet:
```
let
    Source = Sql.Database("server", "database"),
    Sales = Source{[Schema="dbo",Item="Sales"]}[Data],
    #"Filtered Rows" = Table.SelectRows(Sales, each [OrderDate] >= #date(2023,1,1)),
    #"Grouped Rows" = Table.Group(#"Filtered Rows", {"CustomerID"}, {{"Total Sales", each List.Sum([Amount]), type number}}),
    #"Sorted Rows" = Table.Sort(#"Grouped Rows",{{"Total Sales", Order.Descending}})
in
    #"Sorted Rows"

You have the above M query. You need to load only the top 10 customers by sales. What should you add to the query?

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

✓

Add Table.FirstN(#"Sorted Rows", 10) after sorting.

The query already sorts by Total Sales descending. To get top 10, you need to add a step to keep the first 10 rows, using Table.FirstN.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Add a step to use Table.SelectRows with a condition on rank.

    Why it's wrong here

    Using Table.SelectRows to filter on rank is not a direct M operation. You would first need to sort the table and add an index column, then apply a condition such as [Index] <= 10. This approach introduces extra steps and an auxiliary column, whereas Table.FirstN directly returns the first 10 rows from the sorted table. Therefore it is incorrect for this scenario, though it could be made to work with additional transformations.

  • ✗

    Add a filter to keep only rows where [Total Sales] is in the top 10 values.

    Why it's wrong here

    Filtering to keep rows where `[Total Sales]` is in the top 10 values does not guarantee exactly 10 customers. If multiple customers share the same sales amount, this method could return more than 10 rows, failing the requirement to load *only* the top 10 customers. This option is tempting as it correctly identifies a high sales threshold. It would be suitable if the objective were to include all customers whose sales fall within the set of the top 10 *distinct sales amounts*, rather than a strict count of 10 customer records.

  • ✓

    Add Table.FirstN(#"Sorted Rows", 10) after sorting.

    Why this is correct

    After sorting the table in descending order by Total Sales, the immediate next step should be Table.FirstN(#"Sorted Rows", 10). This function returns a table containing only the first 10 rows from the input table, which correspond exactly to the top 10 customers. It preserves the existing row order and is both concise and efficient, making it the required M expression.

  • ✗

    Add a step to use Table.StopAfter(#"Sorted Rows", 10).

    Why it's wrong here

    Table.StopAfter is not a valid M function in the Power Query language, so this step would cause an expression error. The M library includes Table.FirstN and Table.Range for row-limiting operations, but no function named StopAfter exists. Since the goal is to keep the first 10 rows after sorting, Table.StopAfter would not compile and is therefore incorrect.

About these practice questions

One of 524 original PL-300 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

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.