4 Replies Latest reply on Feb 20, 2017 7:38 AM by yogi.sarumaha

# First Purchase Calculated Field of a Certain Category

Hello, I'm trying to find a first purchase of a customer who buys a bedding category and what they are buying on the second purchase. So i created a calculated field of
"First Purchase"

{FIXED [Guest Email] : MIN([date_placed])}

and "Second Purchase"

{FIXED[Guest Email] : MIN([Repeat Purchase])}

and "Repeat Purchase"

iif([date_placed]>[First Purchase],[date_placed],Null)

The problem is i cannot find a bedding "First Purchase" with this formula.
I'm pretty new with tableau, what i expect is adding a product category from the "First Purchase" calculated field.

My table is "ProductClass".
Are there any ways to add function for "First Purchase" calculated field to find specific category?

• ###### 1. Re: First Purchase Calculated Field of a Certain Category

Hi Yogi,

You can specify the category filter within the aggregation calculation using an IF:

{FIXED [Guest Email] : MIN(if [Category] = 'bedding' then [date_placed] end)}

An alternative is to also fix the calculation to the category in addition to the Guest Email

e.g.

{FIXED [Guest Email] ,[Category] : MIN([date_placed])}

J

1 of 1 people found this helpful
• ###### 2. Re: First Purchase Calculated Field of a Certain Category

Hello! yes this works well, however "Null" values appear, what does this value express? does this the emails who did not purchase "Bedding" categories?

• ###### 3. Re: First Purchase Calculated Field of a Certain Category

Yes this is correct. Emails who did not purchase "Bedding".

J

1 of 1 people found this helpful
• ###### 4. Re: First Purchase Calculated Field of a Certain Category

Great! one last question, to show any of the categories the customer is purchasing after they bought 'bedding', what would i add to the second purchase of the calculation field?

"Second purchase" calculated field is as follows:

{FIXED[Guest Email] : MIN([Repeat Purchase])}