6 Replies Latest reply on Aug 29, 2018 12:01 PM by varun kalra

# First Product Purchased by highest revenue product in the basket

Hello,

I am trying to work out the name of the first bought product by a customer. The condition however is that if a customer has 3 products in a basket and checks out at the same time/date, I want to mark the maximum revenue earned product as the first bought product.

I have gone through the post Identifying The First Product Each Customer Purchased | Tableau Software but this query seems to be a bit more precise.

I created a calculated field called "first product purchased" using the above method, but it defaults to first product in the basket.

For eg: for customer id : 541959, I want the the first product purchased to be "Leaflets and Flyers" as it has the highest revenue amongst all products in one basket (one basket id) bought on the oldest date.

Workbook attached

Thanks

Regards

Veekay

• ###### 1. Re: First Product Purchased by highest revenue product in the basket

Hi Varun,

Try this

1 of 1 people found this helpful
• ###### 2. Re: First Product Purchased by highest revenue product in the basket

It Seems you are expecting like below

Create calculation like below

WINDOW_MAX(IF

(SUM({ FIXED [Customer ID],[Basket ID],[Order Date]:MAX([Product Revenue])}))=SUM(([Product Revenue]))

then

ATTR([Product Group])

ELSE

NULL

END

)

Hope this helps kindly mark this answer as correct or helpful so that it will help others

BR,

NB

• ###### 3. Re: First Product Purchased by highest revenue product in the basket

Hi Varun,

Here it is based upon the largest Number of items in basket on OLDEST date. Pl See attached

Thanks

Deepak

If it Helps, Pl Mark it Helpful and CORRECT to close Thread

1 of 1 people found this helpful
• ###### 4. Re: First Product Purchased by highest revenue product in the basket

Thanks Deepak,

This works perfect.

• ###### 5. Re: First Product Purchased by highest revenue product in the basket

This was Tough!!!

• ###### 6. Re: First Product Purchased by highest revenue product in the basket

Thanks Anuvir,

Your solution also works fine. I guess there is more than one way of doing this.