First Post!
I'm trying to use power query to calculate attach rates between two products Parent and Child in my sales data for an ecommerce business.
My data is organized as traditional transaction data where a single row contains the SKU, Product ID and Line ID, plus additional order detail like qty, sales amount, and customer data.
Demand Order Date | Order ID | Order Line ID | Demand Quantity | Product Name | SKU Code |
1/18/2024 | 4559164994139 | 4576253004139 | 6 | Ethernet Power Adapter - Black | YB5-000010 |
1/18/2024 | 4559164994139 | 4575496254139 | 1 | Blue 3-Pack - Black | HG1-000500 |
1/26/2024 | 4561501054139 | 4577130654139 | 2 | Floor Stand - Black | YB5-000007 |
1/26/2024 | 4561501054139 | 45773211474139 | 1 | Table Stand - Black | YB5-000005 |
1/26/2024 | 4561501054139 | 45773264714139 | 1 | Blue 3-Pack - Black | HG1-000500 |
1/30/2024 | 4562004524139 | 45732373114139 | 1 | Blue 3-Pack - Black | HG1-000500 |
The output I'm hoping for is something like below - producing a list of all SKUs in the datasource, and an attach rate for each other product to that parent product.
Parent | Child | Attach Rate |
Blue 3-Pack - Black | Table Stand - Black | 30% |
Blue 3-Pack - Black | Floor Stand - Black | 15% |
Blue 3-Pack - Black | Ethernet Power Adapter - Black | 20% |
I want the attach rate to be calculated at order level, not by qty of units - i.e. Count of orders containing Blue 3-Pack AND Ethernet Power Adapter, divided by count of orders containing the Blue 3-Pack would give me the attach rate of the Ethernet Adapter to the 3-Pack.
I have not used List functions in Power Query before but I'm thinking maybe this holds the solution?
Thanks!