Power Query & M Code to Transform Data & Create Final Marketing Customer Coupon Report. EMT 1902 @excelisfun
Power Query & M Code to Transform Data & Create Final Marketing Customer Coupon Report. EMT 1902  @excelisfun
Uploaded August 2025 | Updated November 2026, 17 hours ago
Download Excel File: excelisfun.net/files/EMT1902.xlsx
Buy Mike “excelisfun” Girvin’s Power Query M Code book at Amazon: amazon.com/Transformative-Magic-Power-Query-Excel/dp/1615470832

Learn how to use Power Query and M Code to transform data and create a complex report. This report will count and list customers that fall into different marketing coupon customer groups. This is an advanced Power Query exercise to create a report that seems impossible, but is easy if you know some M Code.
Topics:
1. (00:00) Introduction.
2. (00:38) Thanks to Bill Szysz for M Code in this video.
3. (00:58) Goal for data transformation and final report.
4. (01:43) Fundamental data problem: we do not have store usage records for all customers. We will have to create the data from existing tables.
5. (02:04) Download Excel file so you can follow along.
6. (02:11) Import initial table into the Power Query Editor.
7. (02:30) Why you always want to remove spaces in M Code Identifiers.
8. (03:13) Load first table as Only Create Connection.
9. (03:26) Import second source data table into the Power Query Editor.
10. (03:31) Remove existing query step.
11. (03:34) Keep customer & store columns in fSales table.
12. (03:44) Remove duplicate customer & store records.
13. (04:36) What is a let expression? And how is structured (M Code Syntax)?
14. (06:16) Create left out join using the merge feature: dCustomer table and fSales table.This pulls store names from sales table into the customer table.
15. (08:19) Reference left outer join query and create intermediate step with customers who used no coupons.
16. (08:53) Filter to get null records.
17. (09:09) Group null records to get count and list of customers who did not use coupons.
18. (10:02) Amend M Code in Table.Group function. We want a list rather than a table.
19. (11:23) Remove store column from null groupby query.
20. (11:55) Begin query to create the final report.
21. (12:11) Filter to remove null records.
22. (12:22) Why we have to pivot table.
23. (12:54) Copy store columns.
24. (13:13) Pivot copied store column with store column as values and the calculations is “Don’t Aggregate”.
25. (13:56) Groupby feature used on store columns to create count and list of customers in coupon groups.
26. (15:18) Create custom variable that can create a dynamic set of store names for the Table.Pivot and Table.Group functions. Use the List.Distinct and List.Sort functions.
27. (17:26) Append Query with Customers who used no coupons to the query with customers who used coupons.
28. (18:19) Sort Count column Z to A.
29. (18:26) Create Custom Column with final columns for the final table as lists. Use the Record.ToList and List.RemoveLastN functions, as well as the join operator ampersand, &, and a null list.
30. (20:55) Create Custom Column with field names for final table.
31. (22:06) Use the Table.FromColumns function to create the final report table.
32. (23:25) Load final report and test it.
33. (24:19) Summary
34. (24:27) Closing

#excel #microsoft #excelisfun #excelcourse #groupby #powerquery #mcode #transformdata #complexreports #powerquerymerge #TableFromColumns, #RecordToList #TablePivot


#excel #excel365 #excelisfun #highlinecollege #mikegirvin
#freeexcellessons
Power Query & M Code to Transform Data & Create Final Marketing Customer Coupon Report. EMT 1902HSTACK Inside XLOOKUP & Cell Lists. Excel Magic Trick 1936.How to Add Subtitles to YouTube Videos in Multiple Language March 25 2025 UpdateMS 365 Excel Basics #10 Part 03: FILTER Array Function to Dynamically Filter!Visualize Inverse Relationship for Bond Price & YTM Rate. #Short Excel Trick 46. ACCTG 455 50.4PivotTables Instantly Update When Source Data Change, Just Like Formulas!! Excel Magic Trick 1900File Explorer Skills To Be Good In Excel? 100% Yes! File Extensions & F2 Trick! EMT 1885Array of Delimiters in TEXTJOIN for the Perfect Join! Excel Magic Trick Short # 76 part 02Excel 365 Basics 06: XLOOKUP, FILTER, XMATCH, LOOKUP, SWITCH Functions to Solve Any Lookup Task!Excel Spilled Loan Amortization Table. #Short Excel Trick 40. ACCTG 455.excelisfun YouTube Channel is 17 Years Old!!!!!!!What is the Difference Between Excel Merge Across & Merge Cells?  #Short Excel Magic Trick 17
excelisfun |

Power Query & M Code to Transform Data & Create Final Marketing Customer Coupon Report. EMT 1902

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER