1 Reply Latest reply on Dec 7, 2018 1:34 PM by Mavis Liu

# Cohort analysis by frequency of Order

Hey forum,

since a while I´m trying to solve a problem of mine, but I feel stuck so I wanted to ask you!

I want to combine a cohort analysis with the frequency of the orders a person made. In detail what I want to have is a stacked bar chart that says if a person ordered in the given month how many orders of the same person have there been before . For example the bar for october says that 5 people ordered the first time 10 the second time 3 the third time and so on.

My company is only selling one product so the product type/Item ID is not relevant.

The formula (Berechnung 3 in the picture) for the cohort itself is:

{FIXED [Row Item ID]: MIN([Order Timestamp])}  ---->  {FIXED [Customer ID]: MIN([Order Timestamp])}  --->  {FIXED [Customer ID]: MIN([Order Timestamp])}

The Frequency(Frequenz 1 in the picture) formula is:

{ FIXED [Customer ID] : COUNTD([OrderID])}

What I managed to do look like this, the top bar being the first order and the bottom bar fourth/fifth order.

1. The color difference is really slight although I´v tried pretty much every color editing possibility, if you know how I can tell Tableau that 1 order equals blue, 2 orders equals green or what ever pleas tell me.

2. The numbers on the bars doesent mirror our raw data at all, so a calculated field has to be wrong but I can´t find the error maybe one of you has the answer!

I would be very gratefulif someone knows how to solve these problmes!

Kind regards,

Jan

P.S.

Pleas excuse my sloppy EnglishI´m not a native speaker

• ###### 1. Re: Cohort analysis by frequency of Order

Hi Jan,

To get distinct colours, you need a discrete field.

So right click on Frequenz  and select discrete.

Thanks,

Mavis