Search code examples
tableau-apidate-arithmetic

Tableau Number of days since last invoice


I have Tableau data which consists of Customer Name and Invoice Date.

Cust 1 - 01/01/2014
Cust 1 - 05/01/2014
Cust 2 - 10/02/2014
Cust 2 - 20/03/2014
etc.

I want to find the number of days since the last invoice for each customer and display the data in a table as follows:

Customer | # of days since last invoice
Cust 1      | 170 days
Cust 2      | 110 days


Solution

  • Once you have the customer field in the rows shelf,

    Create a calculated field like this

    DATEDIFF('day',MAX([InvoiceDate]),NOW())

    Drag this calculated field to the TEXT mark.