6 Replies Latest reply on Nov 19, 2018 11:04 AM by Paul Wachtler

# Line Graph: Product conversion

I have a data set of sales records via accounts, deals that were closed won and others that were not.

I want to be able to show the accounts that purchased a basketball initially then eventually purchased a secondary product of "shoes" or "camp training"

The goal is to see the # of accounts that were converted from initially buying a basketball to another product in the future.

What I'm trying to tease out:

1. the # of accounts that purchased another product after purchasing a basketball (not before)
2. The # of secondary products purchased after the first purchase of a basketball

I took at a stab at trying to solve it with a calculated field but I know the output is wrong

Am I approaching this from the wrong angle? I attached the workbook

Thank you and any guidance is appreciate.

• ###### 1. Re: Line Graph: Product conversion

+bumping

• ###### 2. Re: Line Graph: Product conversion

Hi Juan Pablo,

Here's the calculation I created to solve your request:

For each customer it finds the first time they purchased a basketball (if they didn't, it returns null) and then compares the close date against their purchase of Camp Training or Shoes.  If they have a close date for either of those later than the basketball close date then it returns a 1.

This formula is in the attached workbook.  I also did a quick mockup in the workbook for each of the points you're looking to tease out:

Let me know if you have any questions.

Best,

Paul

1 of 1 people found this helpful
• ###### 3. Re: Line Graph: Product conversion

Paul,

Thank you for such an informative response. I do have 1 question.

I was able to recreate the Line graph of "Secondary Purchase Accounts"

but I was unable to recreate the second line graph you provided to see the # of units in those secondary purchase accounts

I can't see the function inside the pill.

I tried typing what I could see into the pill "agg(ifnull(sum([Secondary Purchase])))" but it just turns red.

Again, thank you so much for your time. It was extremely helpful for me

Best,

Juan

• ###### 4. Re: Line Graph: Product conversion

You're welcome!  For that calculation, you can't type the AGG piece into a calculated field - Tableau automatically put that in there after I typed in the calc.

Here's what you'll want to put into a calculated field for that one:

ifnull(sum([Secondary Purchase]),0)

That just adds zero values for the months that don't have secondary purchases, instead of leaving them null.

Let me know how that works for you.

• ###### 5. Re: Line Graph: Product conversion

That worked! But I realized it wasn't what I initially asked for.

This essentially shows the # of accounts that had a secondary purchase, similar to the first graph.

I was looking for the sum of the # of units of the secondary product purchase

(ex: If an account bought 15 basketballs, but later purchased 5 shoes, I want to show those 5 shoes in the line graph, not the 1 account)

Does this make sense? or should I try to explain it in a different matter?

Thanks!

Juan

• ###### 6. Re: Line Graph: Product conversion

Sure, you just need to change the piece at the end that returns 1 and have it return quantity instead.  Like this:

ifnull(

if {FIXED [Account ID]:

MIN(if [Product] = "Basketball" then [Close Date] end)}

<=

{fixed [Account ID]:

min(if [Product] = "Shoes" or [Product] = "Camp Training"

then [Close Date] end)}

and ([Product] = "Shoes" or [Product] = "Camp Training")

then [Quantity] end

, 0)