1. Lighthouse

Level 2 · Fix types and messy text in a customer export

The request

From Brittany Hayes, Events Manager

“We're opening a pop-up in Tampa in March and I want to invite our Florida customers who joined this year. The CRM export is a mess: 'tampa', 'MIAMI', 'Miami ' with a space, states like 'fl' and ' FL', and 'N/A' where we don't know how they found us. I need it clean enough to count people per city.”

Your goal

The Source step is the CRM export of 54 Florida customers who signed up in 2025, every column as text. Change customer_id to a whole number and signup_date to a date; trim city and state; capitalize each word in city; make state uppercase; and replace "N/A" in referral_source with null.

  • Show exactly customer_id first_name last_name city state signup_date referral_sourcenot done yet
  • 54 rowsnot done yet

Your query steps

Power Query
The sheet for this level
customer_idfirst_namelast_namecitystatesignup_datereferral_source
11243MiguelGarciaMiamiFL2025-01-24email
21249SarahGrayOrlandoFL2025-01-31search
31263FrankCooperMiamiFL2025-02-09friend
41264GraceRodriguezOrlandoFL2025-02-09search
51270BenjaminKellyOrlandoFL2025-02-13search
61311JulieFloresOrlandoFL2025-03-12N/A
71333JamalMillerJacksonvilleFL2025-03-26pinterest
81341RebeccaWoodMiamiFL2025-03-31search
91352CatherineMartinezMiamiFL2025-04-06instagram
101354JosephMillerTampaFL2025-04-08N/A
111355NathanMoralesTampaFL2025-04-08search
121363AaronColemanTampaFL2025-04-12N/A
131366CarolynMyersTampaFL2025-04-13instagram
141382SarahFosterMiamiFL2025-04-26search
151408SusanCastilloTampaFL2025-05-11instagram
161415JamalPhillipsMiamiFL2025-05-13search
171430OwenMoralesOrlandoFL2025-05-19pinterest
181435JoseDavisOrlandoFL2025-05-22search
191438GabrielaMoralesTampaFL2025-05-22N/A
201482LukeKimTampaFL2025-06-15podcast
211494NatalieLopezTampa FL2025-06-18podcast
221497JanetVasquezMiamiFL2025-06-21email
231501ChristinaFloresOrlandofl2025-06-23friend
241520RobertMyersOrlandoFL2025-07-08friend
251545KyleWilliamsMiamiFL2025-07-24search
261564JamalJamesMiamiFL2025-08-03N/A
271577PamelaGrahamOrlandoFL2025-08-11tiktok
281598MaryBrownMiamiFL2025-08-25search
291607ChristinaPhillipsJacksonvilleFL2025-08-31search
301626AvaGreenJacksonvilleFL2025-09-06tiktok
311644JohnReyesTampaFL2025-09-12podcast
321646EthanJacksontampaFL2025-09-14email
331660NatalieBennettMiamiFL2025-09-22N/A
341661LaurenMorganMiami FL2025-09-23podcast
351676EdwardLewis tampa FL2025-09-28pinterest
361687BrendaAndersonMiamiFL2025-10-07instagram
371695HenryButlerOrlandoFL2025-10-10N/A
381720MeganNguyenMiamiFL2025-10-25N/A
391757JenniferHarrisJacksonvilleFL2025-11-06podcast
401765AvaHendersonMiamiFL2025-11-08instagram
411771LoganPerezTampaFL2025-11-10podcast
421773OliviaMyersOrlandoFL2025-11-11search
431802JosephAndersonTampaFL2025-11-18google_ads
441806PriyaParkerTampaFL2025-11-21N/A
451810StephanieCarterMIAMIFL2025-11-21N/A
461829NoahMarshallJacksonvilleFL2025-11-26search
471883ElizabethWalkerTampaFL2025-12-02friend
481892LarryCoxTampaFL2025-12-04pinterest
491897MarcusWallaceJacksonvilleFL2025-12-06N/A
501914HelenRichardsonMiamiFL2025-12-10N/A
511972EdwardBrooksJacksonvilleFL2025-12-23N/A
521981SandraBennettOrlandoFL 2025-12-26pinterest
531982CarolynHudsonTampaFL2025-12-26email
541988JerryMendozaOrlandoFL2025-12-28N/A

Loading the editor…

    ResultPress Check to compare the query result

    Mote checks your result

    Press Check. Mote fills in your answer and compares it with what the report needs.

    The lesson

    A report can only be as clean as its data. Brittany wants to count customers per city, and with Tampa, tampa and tampa in the same column, a visual would show three Tampas. This level is the clean-up pass you’ll run on almost every export.

    The practice editor

    As in the rest of this chapter, you work in a practice editor built for this site: Power Query’s step names and results, one step per line, the table after each step in the preview. In Power BI Desktop the same steps live in Home → Transform data, recorded under Applied Steps in the Query Settings pane.

    Look before you clean

    Power Query helps you find the problems. On the View tab, tick Column quality (valid, error and empty percentages under each header), Column distribution (distinct and unique values) and Column profile (value counts for the selected column). By default they profile the first 1,000 rows; click the text in the status bar to switch to the entire data set. Here, Column profile on city lists Tampa, tampa and tampa as separate values: the first sign of trouble.

    Types first

    The export wrote every column as text. The icon left of each header shows the type: ABC for text, 123 for whole number, a calendar for date. Text IDs sort as 1001, 11, 2, and text dates can’t be filtered by month.

    Change type: customer_id to whole number
    Change type: signup_date to date

    In Power BI: click the type icon on the header, or Transform → Data Type. Power Query writes a Changed Type step:

    Table.TransformColumnTypes(Source, {{"customer_id", Int64.Type}, {"signup_date", type date}})

    Clean the text

    Trim: city, state
    Capitalize each word: city
    Uppercase: state

    All three are under Transform → Format (select the columns first; Ctrl+click selects several). Trim removes spaces at the start and end, Clean (in the same menu) removes invisible control characters, Capitalize Each Word writes Tampa and St. Petersburg, and UPPERCASE writes FL. The M for the first one:

    Table.TransformColumns(#"Changed Type", {{"city", Text.Trim, type text}, {"state", Text.Trim, type text}})

    Missing is not a value

    N/A looks like a referral source called “N/A”. In a chart it would get its own bar, and a count of known sources would include it. Replace it with a real missing value:

    Replace values: referral_source "N/A" with null

    In Power BI: select the column, Transform → Replace Values, Value To Find N/A, Replace With null. Power Query compares the whole cell, case-sensitively, so n/a would need its own step.

    Order of steps

    Steps run top to bottom, each on the previous step’s result. Trim before you compare or deduplicate on a text column; change types before you filter by date. If a step was added in the wrong place, drag it up or down in Applied Steps, or right-click → Delete Until End to start again from there.

    Common mistakes

    • Fixing the visual instead of the data. Renaming one bar doesn’t fix the next refresh.
    • Uppercasing a city. TAMPA is consistent but hard to read; proper case is the convention.
    • Typing values over cells. Power Query has no cell editing; every fix is a recorded step, and that’s what makes it repeat on refresh.

    Pick what may run on this site. You can change this any time from "Cookie settings" at the bottom of every page.