3 Replies Latest reply on Sep 13, 2017 3:00 AM by sally ball

Calulated field to count No of records for multiple criteria

Hi,

I need to create a calculated field as above.  Its to count the total number of records where:

• The persons age is 16, 17 or 18 (which is already a calculated field at a set date)
• and their eligibility status meets two of three possible statuses ('Eligible' or 'Not eligible' - ignoring a third status of 'Invalid')

Can anyone suggest a solution please?

• 1. Re: Calulated field to count No of records for multiple criteria

Hi Sally

Not sure but find my approach as reference below and stored in attached workbook version 10.2 located in the original thread

1. delta: year([date])-year([point])

2. Date count: if [delta]>=16 and [delta]<=18 then "count" else "do not count" end

3. Status count: if [status]="Eligible" or [status]="Not eligible" then "count" else "do not count" END

4. End count: if [Date count]=[Status Counter] then 1 else 0 END

Regards,

Norbert

• 2. Re: Calulated field to count No of records for multiple criteria

An alternative approach is to:

- convert age to a dimension

- create a set for age 16, 17 or 18

- create a set for 'Eligible' or 'Not eligible'

- create a calculated field like:

count(if [Age Set 16, 17, 18] and [eligibility set]  then [any field present on every row without nulls] END)

[any field present on every row without nulls] might be something like [member id]

hope that helps.

check this thread for more on simulated "IN" https://community.tableau.com/ideas/1500

1 of 1 people found this helpful
• 3. Re: Calulated field to count No of records for multiple criteria

This works perfectly with the data I have - Thank you!