CJL89
CJL89

Reputation: 115

Tableau - Filter Based on 1st Order

I have a quick question. I'm trying to grab user ids based on their 1st purchase and products selected:

ID       Purchased
123      NSABC
124      NSDE
125      NSABC
123      EDEF

The way you know it's a 1st order and products that I want is with "NSABC". Then, I want to grab all the following rows irrespective of their purchase as long as the ID match. So in this scenario, ID 123, 125 I want Tableau to show the following:

123      NSABC
125      NSABC
123      EDEF

However, the issue is that when trying to write a calculated field, I only get the first purchase. My calculated field is:

IF CONTAINS([Purchased], 'NSABC') THEN ID END

This parses out the other result:

123      EDEF

Is there a way to check the 1st occurrence to = "True" and then grab all subsequent actions? I'm guessing I need some kind of LOD or any other calculated field?

The NS flag means new customer and the E is an existing and therefore it gets replaced. All other letters are just product codes that can potentially change if they want to buy something else.

Upvotes: 0

Views: 92

Answers (1)

AnilGoyal
AnilGoyal

Reputation: 26218

use this calculation

{ FIXED [ID] : sum(IF [PURCHASED] = 'NSABC' THEN 1 ELSE 0 END)} > 0

and select all records with TRUE condition (filter). See

enter image description here

Upvotes: 1

Related Questions