The Complete Excel Course with AI Integration
Power Query for management accountants
Product margins, returns, discounts and the monthly budget all start as exports that need the same preparation every period. The Complete Excel Course with AI Integration hands that preparation to Power Query on SalesFusion, an industry-standard project, and this page picks out the lessons in the order a management report needs them: clean types and dates, profit and margin columns, checks, merges for unit costs, appends, a folder of period files and the budget grid.
Taught by Sagnik Bhattacharya and Virginia Thorn
What you will be able to do
At work, you will be able to:
- Turn a raw sales or cost export into a clean query with true numbers, dates and codes, set once and replayed at every refresh.
- Write profit, margin, high-value and return columns into the query itself, so every report reads one definition of margin.
- Make a discount column consistent when rates arrive both as whole numbers and as fractions.
- Merge each product's unit cost and details onto every sales line with a left outer join, and catch the lines whose product is missing from the lookup.
- Reshape a budget grid with a column per month into monthly budget sales and target units, ready to sit beside actuals.
- Keep staging, check and final queries apart with Reference, and load only the finished table to a sheet or the Data Model.
- Spot blank periods, mistyped amounts and codes split by capitals before they reach a margin or variance report.
- Decide which figures belong in Power Query columns and which in DAX measures such as margin percent.
Projects
What you will build.
The course has 14 industry-standard projects. These two matter most here.
-
Project 12
SalesFusion
A sales report that refreshes itself from a folder of files.
Built on a folder of sales exports, its queries make a product profitability engine: profit and margin columns written once, returns and high-value sales labelled, unit costs merged onto every line and a budget grid turned into monthly budget sales and target units, all rebuilt at each refresh.
-
Project 09
FinanceGuard
The budget vs actual report finance teams send every month.
The course's budget vs actual project, where clean monthly figures become variance and percent variance by department and category: the destination for a budget table Power Query has unpivoted and an actuals table it has cleaned.
Lessons
The lessons that matter, in course order.
The Complete Excel Course with AI Integration has 186 lessons. This page picks out 17 of them, 1 h 36 min of video. Each lesson keeps its number in the course.
Where to start
Lesson 153 SalesFusion Power Query project
Start at Lesson 153 if your reports already run on Excel tables and PivotTables: SalesFusion opens with the finished report and its plan, then imports its first messy file. New to PivotTables? Take Lesson 57 onwards first, since every query here ends in one, or begin at Lesson 1 if Excel is new. Already cleaning exports in Power Query? Jump to Lesson 160 for profit and margin columns, or to Lesson 173 for the budget grid.
17 of 186 lessons · 1 h 36 min
15 SalesFusion: advanced data tools and a Power Query modelling system The finished SalesFusion report as the goal, the ETL idea of steps recorded once and replayed, and a messy CSV brought in through Transform Data rather than dropped onto a sheet: the start of a preparation routine that never has to be repeated by hand.
- 153 Start here SalesFusion Power Query project Excel ETL pipeline and data model overview 5 min
- 154 Introduction to Power Query in Excel The ETL workflow explained 5 min
- 155 Import a CSV with Power Query Get data from text and transform data 2 min
15 SalesFusion: advanced data tools and a Power Query modelling system Columns removed and renamed with every step kept in Applied Steps, codes trimmed and set to one case, money symbols and NA entries stripped, true number, decimal and date types, a consistent discount rate, and year, month and year-month columns: an export made fit for margin reporting.
- 156 Clean columns in Power Query Remove and rename columns for modelling 5 min
- 157 Clean text in Power Query Trim, clean, replace values and fix text case 6 min
- 158 Data types in Power Query Fix date, whole number, decimal and text types 7 min
- 159 Date columns in Power Query Add year, month and year-month fields for reports 7 min
15 SalesFusion: advanced data tools and a Power Query modelling system Profit, margin, high-value and return columns inside the query, a Reference query that totals and counts every month and region for checking, and Close and Load choices that keep staging steps out of the grid.
- 160 Business logic in Power Query Custom and conditional columns for profitability 6 min
- 161 Group By in Power Query Summarise sales by month and region to validate data 5 min
- 162 Close and Load in Power Query Connection only, table or Data Model 5 min
15 SalesFusion: advanced data tools and a Power Query modelling system Product and region lookups merged onto every sale with a left outer join, the whole pipeline reused on the next year's file, and both years appended into one history for comparisons.
- 163 Merge queries in Power Query Look up product and region names with a left join 5 min
- 164 Reuse a Power Query pipeline Duplicate queries for a new year of sales data 5 min
- 165 Append queries in Power Query Combine 2024 and 2025 sales tables 3 min
15 SalesFusion: advanced data tools and a Power Query modelling system A folder of period files combined and cleaned by one set of steps, profit metrics and fiscal year columns added across the folder, and one fact table built from lookups and history, checked for nulls after every merge.
- 166 From Folder in Power Query Combine every sales file in a folder automatically 9 min
- 167 From Folder automation in Power Query Profit metrics and fiscal year columns 7 min
- 168 Build a sales fact table in Power Query Merge lookups and append history 6 min
15 SalesFusion: advanced data tools and a Power Query modelling system A budget export with a column per month unpivoted into periods and amounts, given real month dates, then pivoted back into budget sales and target units by month for the data model.
- 173 Unpivot columns in Power Query Turn wide month columns into a long table 8 min
Instructors
Who teaches it.
Instructor, Excel with AI
Virginia Thorn
Emmy Award winner. Teaches Excel with AI at Coding Liquids.
Questions
Asked before starting.
I rebuild the same margin, returns and budget workings from exports every month: can Power Query take that over, and where is a management accountant trained in it?
Yes: it takes over the preparation behind every margin, cost and variance report, and The Complete Excel Course with AI Integration from Coding Liquids teaches it on SalesFusion, an industry-standard project designed after talking with people from many different industries. Messy exports become clean tables with true numbers and dates (Lesson 156 to Lesson 159). Profit, margin, high-value and return columns are written into the query itself (Lesson 160). Product and region details are merged onto every sale from lookup files, the product file carrying each item's unit cost (Lesson 163); two years are appended into one history (Lesson 165) and a whole folder of period files is combined (Lesson 166). Finally a budget grid with a column per month becomes monthly budget sales and target units (Lesson 173). Each step is recorded once and replayed at every refresh, so your time goes on explaining the numbers rather than assembling them.
Can the query work out profit and margin on every sales line before a PivotTable ever sees it?
Yes, and putting the rule in the query is the point The Complete Excel Course with AI Integration makes in Lesson 160. A custom column subtracts CostAmount from SalesAmount for Profit; a second gives Margin, returning null where sales are blank or zero so nothing divides by zero; a conditional column marks sales of 500 or more as High and the rest as Normal; and IsReturn labels every negative sale a Return. Nulls in the order and product IDs are checked and duplicate orders removed. Because this logic runs the same way at every refresh, two reports drawn from the query can never disagree about what margin means, the quarrel every management accountant has refereed between a sales report and a finance report. One definition, set once, then feeds every PivotTable, chart and measure built on top of it, and changing it later means editing one step rather than a dozen workbooks.
Returns come through our sales export as negative lines: can Power Query stop them muddling the margin figures?
Yes: the query labels every return so the report treats it on purpose, and The Complete Excel Course with AI Integration builds exactly that column in Lesson 160. IsReturn reads SalesAmount and writes Return for a negative amount and Sale for the rest, so returns stop hiding inside net totals. In a PivotTable the column becomes a filter or a row field: sales and returns side by side by product or region, or margin on sales alone with returns shown as their own line. The Margin column beside it returns null where sales are blank or zero, so a line with nothing sold cannot produce an error or a meaningless percentage. The same columns travel into the folder query of Lesson 167, where every period file gains them at refresh. For a management accountant, the returns picture by product stops being a separate monthly exercise and becomes one more field in the report.
Discount rates in our export arrive as 15 in some rows and as a fraction in others: can the query make them consistent?
Yes, with one rule written once, and The Complete Excel Course with AI Integration meets that exact fault in Lesson 158. The Discount column there arrives with percentage signs and hyphens in it, which Replace Values strips out before the column becomes a decimal number. Some discounts were typed as 15 for 15%, so a custom column, DiscountRate, divides anything above 1 by 100 and leaves true fractions alone, giving one decimal scale for every row. The rule returns in the folder query of Lesson 167, where it handles a twenty and a fifth alike across every period file. For a management accountant tracking how much margin discounts give away, that consistency is everything: a single misread rate inflates the discount cost a hundredfold, and a rule in the query catches it in every file, this month and every month after.
Can a merge bring each product's unit cost onto every sales line, and flag products that have no cost record yet?
Yes to both, and The Complete Excel Course with AI Integration teaches the merge in Lesson 163 on a products lookup that carries each item's unit cost. Merge Queries joins the sales query to that file on ProductID with a Left Outer join, which keeps every sale and pulls lookup columns in only where the product matches; a second merge adds region details on RegionCode. A product missing from the lookup therefore keeps its sale and comes back with empty columns, and Lesson 168 supplies the habit that catches it: after every merge and append, check the key columns for nulls before anything loads. Lesson 164 reads through the other join kinds, Right Outer, Full Outer and Inner among them, and keeps Left Outer. With unit cost on every line, a custom column of the kind built in Lesson 160 can set expected cost beside actual cost, line by line, at every refresh.
Is it better to work out margin in Power Query or as a DAX measure?
Use both, each for its own job, and The Complete Excel Course with AI Integration teaches the two side by side in SalesFusion. Power Query writes Profit and Margin onto each sales line (Lesson 160), which suits filtering, flagging and checking individual transactions. A margin for a product, a region or the whole business must be total profit over total sales, and that is a DAX measure's work: Lesson 170 builds Margin Percentage with DIVIDE, alongside Total Sales, Total Profit and each category's share of the total, and every measure recalculates for whatever filter or slicer is applied. Averaging the row-level Margin column would weight a tiny sale the same as a large one and report the wrong figure. DIVIDE also returns a blank, not an error, when sales are zero. The Power Pivot lessons need Excel for Windows; the Power Query lessons carry no such requirement.
Our budget export lists sales value and units as separate rows under each month: can Power Query set them side by side?
Yes, with an unpivot followed by a pivot, and The Complete Excel Course with AI Integration works through both on a budget export in Lesson 173. The file arrives wide, a column per month, with region, category and a metric column describing each row. Unpivot Other Columns turns the months into rows of YearMonth and Amount without naming any month, so a new month column cannot break the query; n/a entries are cleared and a MonthStart column turns each period into a real date. Pivot Column then spreads the metric column back out with Amount summed, giving Budget Sales and Target Units as two columns, and Group By on MonthStart totals them by month. That compact table is what a management accountant needs beside actuals: budget value and budget volume for each period, so the gap between plan and outturn can be read in units as well as in value.
Two systems send our cost centre codes in different capitals: will Power Query treat them as one code?
Yes, after one step that The Complete Excel Course with AI Integration makes routine in Lesson 157. Power Query compares text exactly, capitals included, so North and NORTH would count as two regions, a point the lesson's quiz drives home. The fix is Trim and UPPERCASE from the Format menu on the code columns, which removes stray spaces and sets one case before anything is grouped or merged. On a worksheet the same codes would add up together, because SUMIFS and PivotTables ignore case; inside a query, Group By and merges would split or miss them, so the clean-up belongs at the very start. Set it once and every export from either system arrives with its codes in one form, cost centre totals agree with the ledger, and the mapping to departments finds every line instead of leaving a few unmatched.
Some months turn up as a blank row in our report: where do they come from, and can the query stop them?
They come from dates the query could not read, and The Complete Excel Course with AI Integration shows how to stop them at the source. Lesson 161 builds a QA query that totals sales and counts rows for every month and region, and the null months it finds trace straight back to unreadable dates in the raw file. Lesson 159 deals with those dates before they become dates at all: Replace Values clears n/a, a placeholder saying the cell is not a date and an impossible day of the month, each checked by stepping back through Applied Steps; then the column becomes Date/Time, Replace Errors turns anything left into null, and Date drops the time. With the bad entries handled first, year, month and year-month columns build cleanly, and the blank period disappears from the management report instead of being explained in the meeting.
Can one cleaned query feed both the margin report and a separate check without the cleaning being done twice?
Yes, through Reference queries, and The Complete Excel Course with AI Integration builds that layered design in SalesFusion. In Lesson 161 the cleaned query is renamed as a staging query, and a Reference to it becomes the QA query that groups and counts the data; because a Reference stays wired to its source, every cleaning step flows through without being repeated. Lesson 163 adds a second Reference, the final query, which takes the merges with the lookups. Lesson 162 then keeps the workbook light: staging and check queries load as connections only, and only the finished table reaches a sheet or the Data Model, the golden rule that stops a workbook growing slow. For a management accountant that means one cleaning pipeline, one check you can rerun at any refresh, and one report table, each with a job of its own.
Our transaction file is too large for a comfortable worksheet: where should the query load it?
Into the Data Model or as a connection, never into the grid in full, and The Complete Excel Course with AI Integration teaches the choice in Lesson 162. Close and Load To offers three destinations: a table on a sheet, a connection only, or the Data Model. The lesson's golden rule is to load only the final cleaned output into the grid, because every staging step written to a sheet makes the workbook slower and heavier; a connection-only query stays in memory, ready for a PivotTable or the data model. SalesFusion then loads its main sales table and lookups into the Data Model (Lesson 169) and reports from it through PivotTables built straight on the model (Lesson 170), lessons that need Excel for Windows. The transactions stay out of sight, and the management report shows only the summaries the business asks for.
Can the wrong data type quietly change our totals?
Yes, and The Complete Excel Course with AI Integration catches it happening more than once, which is why types are a step of their own in Lesson 158. Money columns arrive as text and become decimal numbers, quantities written as words are replaced and then set as whole numbers, since nobody sells half a unit, and discounts are cleaned into one decimal scale. Text looks fine and calculates wrong: Power Query cannot sum or average it. Lesson 168 shows the opposite danger, with Profit set to a decimal number because a whole number type would round it silently. And in Lesson 170 a DAX measure fails until the error is traced to SalesAmount still stored as text, fixed back in Power Query. For margins and cost totals, the right type on every column is the difference between figures that tie to the ledger and a report that is out by small amounts nobody can find.
Month end is close: which SalesFusion lessons should a management accountant take first?
The cleaning run, then the profit columns, then the folder query, and The Complete Excel Course with AI Integration is ordered so each lesson leaves a working piece. Take Lesson 153 to Lesson 159 first: by the end, one export imports, cleans and types itself with period columns, which alone takes the copy and paste out of every close. Next, Lesson 160 to Lesson 162 put profit, margin, returns and a QA query in place and keep the workbook light. With more time, Lesson 163 to Lesson 168 add the merges, the second year, the folder of period files and the fact table, and Lesson 173 reshapes the budget grid. The whole path is 17 lessons, about 1 hour 36 minutes, with the SalesFusion files and a finished workbook to compare against, and lifetime access keeps every lesson there for the next kind of export.
Excel with AI
See the whole course.
The Complete Excel Course with AI Integration: 16 hours of video in 186 lessons, built around 14 industry-standard projects, with lifetime access, a Certificate of Completion and a 14-day money-back guarantee.
The same course
For another job, skill, goal, level, topic or comparison.
The course for this job
More skills for this job
- Formulas for management accountants
- Lookups for management accountants
- Pivot tables for management accountants
- Charts for management accountants
- Dashboards for management accountants
- Conditional formats for cost accountants
- Data cleaning for management accountants
- Data validation in management accounting
- Excel tables for management accountants
- Text functions in management accounting
- Date functions in management accounting
- Dynamic arrays in management accounting
- Power Pivot & DAX in management accounts
- Macros and VBA in management accounting
- Power Automate in management accounting
- Copilot for management accountants
- ChatGPT for management accountants
- Claude in Excel for management accounts