5 Replies Latest reply on Mar 2, 2012 2:46 PM by Alex Kerin

# Simple question; count number of values for their last entry

Hi

I'm pretty new to Tableau and I'm still struggling even to create basic calculation, so bear with me here!

I'm trying to count the number of user per number of purchases.  For example; my table would look like this:

- userID 1, purchase 1

- userID 1, purchase 2

- userID 2, purchase 1

- userID 1, purchase 3

- userID 3, purchase 1

- userID 2, purchase 2

- userID 4, purchase 1

End result should be something like this:

number of purchase:  1 : 2 users

number of purchase:  2 : 1 user

number of purchase:  3 : 1 user

Right now, I'm doing a countd on the number of user at each purchase, but it skew my data (in that example, I'm currently having 4 users that are in purchase 1).  I'm sure it's simple, but I can't figure it out yet! :S

Thanks all in advance!

Sam

• ###### 1. Re: Simple question; count number of values for their last entry

What field do you have that defines 'last' purchase?

• ###### 2. Re: Simple question; count number of values for their last entry

I don't actually, that's kind of the problem.  Basically, I have an event that is triggered for each purchase, but the system doesn't remove "old" events.  That's why, if I'm only grouping by purchase and counting the number of userID per purchase I get 4 users on purchase 1...

• ###### 3. Re: Simple question; count number of values for their last entry

Then I guess you have issues - Tableau will need some way of defining last, even if you bring in a unique ID that increments. Where is the data from, and what other fields are available?

• ###### 4. Re: Simple question; count number of values for their last entry

I don't have much fields; a unique ID, the user ID, the purchase number (1, 2, 3, etc) and the date.

I was thinking there was a way for me to get per user their MAX(purchaseNumber), then count the number of userID per MAX(purchaseNumber) and display it.  I tried to play with MAX, but so far I only get the maximum number of purchase made by 1 user..  Not really helpful..

There is no realy way for the system to know which purchase is last since it would be to time-consuming to search back in the purchase history, find the old "last-purchase", modify the entry to remove the "last" tag and retag "last" the new purchase entry.

Which is why I'm hoping to find a way to display the info with Tableau somehow?

• ###### 5. Re: Simple question; count number of values for their last entry

Great thinking - we can use the purchase ID - is it possible for you to post some of your data - mocked up if sensitive.?