Power Query from Scratch, Part 5: Parameters, functions and a model that refreshes itself
A hardcoded folder path and a copy-pasted business rule are the same problem, and parameters plus functions are how you stop editing M code every month.
Tutorials, tips, and deep dives on Power Query — every post from bianca.codes tagged Power Query.
A hardcoded folder path and a copy-pasted business rule are the same problem, and parameters plus functions are how you stop editing M code every month.
One wide CSV, thousands of repeated names. By the end you have a fact table, two dimension tables, and a model Power BI actually wants.
Three parts of buttons, then a request that needs an 'and' the Conditional Column dialog doesn't have - time to type your first line of M.
Unpivot, split column and group by all look foolproof, right up until the source file adds a column or a name gets typed slightly differently than expected.
Files, folders, and multiple sheets go in three different ways, and the append-versus-merge decision is where most people guess wrong.
Nobody decided to build a database out of that 80-tab workbook - it ended up doing a database's job without any of a database's guarantees.
Most people learn Power Query by clicking through wizards. Nobody explains what it's actually doing - and that gap is why queries break in confusing ways.
The mechanics of cleaning data are the straightforward part. The hard part has no function and no checklist: deciding which imperfections actually matter, and stopping there.
The stakeholder emails asking whether the numbers are current stop the day you put the actual refresh time on the report - and a measure with NOW() is not how you do it.
Power Query carves one flat sales table into a fact and three dimensions, you build the relationships, and you prove the numbers didn't move - a restructure you can't validate is just hope.
Copying a query and tweaking the copy feels efficient. It isn't - three copies of the same logic is three places to update and three ways for it to drift.
The same trim-and-title-case steps are copy-pasted across three of your queries - write them once as a function instead, and fix the rule in one place.
You've built the same cleanup steps in four different queries. A custom function is how you write them once and call them from all four.
A query parameter holds your data source path, so switching from a test CSV to the production SharePoint file is one dropdown, not a find-and-replace through your M code.
Connect Power BI to a SharePoint List the way that doesn't fall over at 5,001 rows - OData filtering at the source, an indexed filter column, and a refresh schedule that doesn't need a gateway.
You'll build a dropdown list that reads from a structured table and includes every new row automatically. No named range maintenance, no 'why isn't my new entry showing up' moments.
In a small team, you're the analyst, the engineer, the dashboard designer, and the person who explains what a p-value is at the all-hands.
The Keep Rows filter in the Power Query UI handles 80% of row filtering tasks without you ever opening the Advanced Editor. Most people skip past it and go straight to writing M. Five clicks and you're done, and the M it generates is clean enough to modify later.
The analysts who get traction aren't the fastest at pulling data, they're the best at unpacking what was actually being asked. The skill is asking good questions, and nobody trains for it.
You can't build every dashboard that gets requested. But 'no' lands differently depending on how you say it — and most data people either say yes to everything and resent it, or say no in ways that…
The more competent you get, the less people see the effort behind what you deliver. A clean dashboard looks effortless. A fast turnaround looks like it was always fast.
Most dashboards answer the question 'what happened?' Very few answer 'what should we do?' The gap isn't data — it's intent. A dashboard built for the former often actively gets in the way of the la…
They ask for a pie chart when they need a bar chart. They ask for a table when they need a trend line. This isn't ignorance — it's that they're translating a question into a visual type without kno…
You delivered a clean model, a solid dashboard, a real solution — and got a blank look in the room. The work was right. But explaining technical work to someone who doesn't share your frame of refe…
Power Query is a brilliant transformation tool. Most of the M code in production is doing things that belong in DAX, SQL, or Python - and the models are slow and the code is unmaintainable.
You'll build a reusable Power Query that finds the most recent entry per group - the kind of query that normally tempts people into messy MAXIFS workarounds in Excel. We're doing it properly, wit…
Table.Group in Power Query returns a table of tables, unlocking complex multi-level analysis you can't get anywhere else.
You built the flow. It ran perfectly for two months. Then a colleague renamed a SharePoint column, or moved a file, or changed a dropdown value - and everything stopped. This isn't bad luck. It's…
Stop cringing. There's a way to talk about your accomplishments in Excel and Power BI that sounds competent, not arrogant. It's all about framing.
The advice is everywhere: if you're serious about data, you need SQL. But for most analysts already working in Excel and Power BI, the gap isn't SQL knowledge - it's data modelling instinct. Here…
You deliver good work consistently, your manager knows you're reliable — and yet somehow you're invisible at promotion time. The problem isn't your output. It's that you've never made your work l…
It is 2026, and we are still stringing together premium Power Automate connectors just to avoid the Word mail merge wizard.