Calculating Attach Rate - when product B is on a transaction that also has product A
![calebtyrone](https://us.v-cdn.net/6032830/uploads/defaultavatar/nZ5X977MOM3Z6.jpg)
Hi experts.
I have a set of sales data where each product has a row for the number of units sold on each Sales Order.
I want to calculate the Attach Rate - where Product Type B was sold in a transaction that also had Product Type A.
So in the example below there were 4 transactions where Product A was sold, and in 2 of them, Product B was also sold. So the Attach Rate would be 50%.
Is there a way to calculate this in a Beast Mode? I have tried a few things but think I might be going about it the wrong way.
Answers
-
There might be a way to do this with a fixed function beast mode, but I'm not sure how at the moment. I'll give it a shot and update if I can figure something out.
However, if I had to do this, I would probably do something in Magic ETL to unpivot the products so that I had one row per order and then a column for each product, so then I could compare the products per order across the row. Another route would be to concatenate the products that were purchased, but it's the same concept - getting all of the products purchased onto the same row. Then I would build a beast mode to look for sales for product A, and any rows that had sales for product A and product B.
0 -
Sorry If I've taken this too literally - this solution may not work if you have a lot of different products that you're trying to find attach rates for. I did get it to somewhat work with a couple of fixed function beast modes, though it's not an ideal solution.
First, I made a beast mode that looked for orders that include product A: max(max(distinct case when
Product
= 'A' then 'Y' else 'N' end) fixed (byID
)). I used this to filter on 'Y'.Then, I made an 'Attach Rate' metric: sum(count(distinct case when
Product
= 'B' thenID
end) fixed (byID
filter allowProduct A filter
))/COUNT(DISTINCT case whenProduct
= 'A' thenID
end)This method only worked, however, if I kept the order IDs in the card:
If I removed the IDs, it looked like this:
Maybe someone with better fixed calc skills can get this over the finish line for you.
0 -
Thanks Sean. I had tried something similar to what you tried with a beast mode, but was not quite getting the results. I definitely need it to not have the ID in the card as I need to show the overall Attach Rate.
I'm think I'm going to have to go the ETL route.
Thank again for having a go.
1
Categories
- All Categories
- 1.9K Product Ideas
- 1.9K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 303 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 3K Transform
- 104 SQL DataFlows
- 640 Datasets
- 2.2K Magic ETL
- 4K Visualize
- 2.5K Charting
- 769 Beast Mode
- 72 App Studio
- 43 Variables
- 718 Automate
- 185 Apps
- 462 APIs & Domo Developer
- 57 Workflows
- 14 DomoAI
- 40 Predict
- 17 Jupyter Workspaces
- 23 R & Python Tiles
- 402 Distribute
- 116 Domo Everywhere
- 277 Scheduled Reports
- 9 Software Integrations
- 135 Manage
- 132 Governance & Security
- 8 Domo Community Gallery
- 44 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 111 Community Announcements
- 4.8K Archive