8 Replies Latest reply on Nov 19, 2018 10:14 PM by Ombir Rathee

Customers Purchase Details

Hello,

Great to join this Tableau Discussion..i am new to tableau..

I have the following two questions..

Can you guide me in building the visualization for the below requirements.

1.How many customers have purchased in the consecutive 2 years and also ordered in the current year(example--2016 and 2017 previous years and 2018 as current year)

2.How many customers have purchased earlier but no transaction this year.

The above questions to be answered based on the super stores sales data.

Thanks

Barry Plum

• 1. Re: Customers Purchase Details

Created the two calculated fields for two problems. Add these fields to Filter Shelf one at a time and select True.

Problem 1:

{FIXED [Customer Name]: COUNTD(IF [Order Date]> DATEADD('year',-2,DATETRUNC('year',TODAY())) THEN YEAR([Order Date]) END)}=3

Problem 2:

{FIXED [Customer Name]: MAX( IF {FIXED [Customer Name]: MAX(YEAR([Order Date]))} < YEAR(TODAY()) THEN TRUE END )}

• 2. Re: Customers Purchase Details

Hi Rathee,

Wen i Add the calculated field to the filter shelf ad select TRUE it

displays no data.

1. I have put the the customer name to the rows shelf and order date to the

column shelf..

2. I have also added order date to the filter shelf and applied filter to

only 3 years...2015,106,2017,

Thanks

Sanju

On Mon, Nov 19, 2018 at 10:01 AM Ombir Rathee <tableaucommunity@tableau.com>

• 4. Re: Customers Purchase Details

Hi Rathee,

Thanks

On Mon, Nov 19, 2018 at 11:44 AM Ombir Rathee <tableaucommunity@tableau.com>

• 5. Re: Customers Purchase Details

Your data set doesn't have current year data. That's why filter was not working. Modified it for Latest year present in dataset.

• 6. Re: Customers Purchase Details

Hi Rathee,

The data set should be considered as follows. ..the previous consecutive

years should be 2015,2016 and current year as 2017.

ThanKS

Sanju

On Mon, Nov 19, 2018, 23:34 Ombir Rathee <tableaucommunity@tableau.com

• 7. Re: Customers Purchase Details

Hi Rathee,

Can you send me the modified code,

I dont find it in your last email.

Thanks

Sanju

Thaks

On Mon, Nov 19, 2018 at 11:34 PM Ombir Rathee <tableaucommunity@tableau.com>

• 8. Re: Customers Purchase Details

I attached workbook in thread. may be you're checking in email. Anyway, see below:

Problem 1:

{FIXED [Customer Name]: COUNTD(IF [Order Date]> DATEADD('year',-2,DATETRUNC('year',{MAX([Order Date])})) THEN YEAR([Order Date]) END)}=3

Problem 2:

{FIXED [Customer Name]: MAX( IF {FIXED [Customer Name]: MAX(YEAR([Order Date]))} < YEAR({MAX([Order Date])}) THEN TRUE END )}