← All challenges

P3 · Power Query · about 10 min

Find the Real Header

easy

The roster comes from a report export: a title, a subtitle and a blank line above the real column names, and a Total line at the bottom. The first attempt removed the title lines, and the team page now shows twice the league's runs.

Your task

Load Roster_export.csv from the SourceFolder folder as a table named Roster with columns PlayerID, Name, TeamID and Runs (whole numbers except Name): one row per player, nothing else.

What the grader checks

You see the situations, not the expected numbers. The expected values are computed live from your file and the source data.

  • T1One row per player
    Roster compared row by row with the players in the file, matched on PlayerID: no title, blank or Total rows.

Stuck?

Open one hint at a time.

Hint 1

Scroll to the bottom of the preview, not just the top. Is every row a player?

Hint 2

Rows above the header are easy to see. Rows below the data, like a total, are easy to miss, and they add up with everything else.

Hint 3 (near-answer)

Remove the top rows until the column names are the first row, Use First Row as Headers, then filter PlayerID to remove "Total" and blank rows (or Remove Bottom Rows).

Show the editorial

Solve it first if you can: the editorial gives the answer away.

The trap

Report exports wrap data in presentation: titles above, totals below. Removing the title rows fixes the header, but the Total line is still a row, and its Runs value is the sum of every player. Any measure that adds Runs now counts the league twice, and the roster has rows that are not players.

The fix

Skip the rows above the header, promote the header, then remove the Total line and any blank row (filter PlayerID, or Remove Bottom Rows).

Why it works

A table should hold one kind of row: here, one row per player. Totals belong in measures, which compute them from the rows; a stored total double-counts as soon as anything sums the column.

Check both ends of an imported file. Remove titles at the top and totals at the bottom: a table holds rows, not results.