Beast Mode

Beast Mode

Calculating Attach Rate - when product B is on a transaction that also has product A

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.

image.png

Welcome!

It looks like you're new here. Members get access to exclusive content, events, rewards, and more. Sign in or register to get started.
Sign In

Answers

  • Contributor

    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.

  • Contributor

    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 (by ID)). I used this to filter on 'Y'.

    Then, I made an 'Attach Rate' metric: sum(count(distinct case when Product = 'B' then ID end) fixed (by ID filter allow Product A filter))/COUNT(DISTINCT case when Product = 'A' then ID end)

    This method only worked, however, if I kept the order IDs in the card:

    image.png

    If I removed the IDs, it looked like this:

    image.png

    Maybe someone with better fixed calc skills can get this over the finish line for you.

  • 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.

Welcome!

It looks like you're new here. Members get access to exclusive content, events, rewards, and more. Sign in or register to get started.
Sign In