2 Replies Latest reply on Dec 16, 2013 11:10 AM by Matthew McLaughlin

# Calculating the first occurrence of a value in a column

Morning, all!

Looking to calculate if an item is the first occurrence in certain row.  In Excel, I can easily specify the cell and every cell above it.  In Tableau, I'm lost.

Excel file attached.  Column A contains the item I'm searching for.  Column B returns "True" if that row is the first occurrence in the column.  I later take all rows that are True and use them in another calculation.

How do I go about recreating this in Tableau?  I'm using v8.1.

Matt

• ###### 1. Re: Calculating the first occurrence of a value in a column

Hi Matthew,

You can achieve this using Tableau table calculation "lookup"

```Attr([Concatenate])!=lookup(Attr([Concatenate]),-1) Or isnull(lookup(Attr([Concatenate]),-1))
```

-Indumon

• ###### 2. Re: Re: Calculating the first occurrence of a value in a column

Indumon,

Thanks for the quick response!  My worksheet appears to be grouping and sorting (for the most part) the Concatenation field.  I don't know why as I have no sorts or As a result, everything is coming up as "True".  Is there perhaps a better way to do this function?  I am not set on any method...I'm merely porting our current method from Excel to Tableau.

The Concatenation field is:

(str([Order No]))+(str([Item No]))+(str([PO Item Sequence]))+(str([Blanket Seq]))

All we're looking to do is find the first time a part was received from every PO that was scheduled to arrive in a given month.  This is necessary to calculate how late the supplier is.

Matt