6 Replies Latest reply on Dec 1, 2018 3:12 AM by Jim Dehner

# Count number of records based on a condition

I'm trying to make a calculation of how many Parent transactions were profitable or not

Each parent transaction can have multiple sub-transactions and the defines whether it was profitable or not (sample table with green/orange highlighted cells)

The final output I'm looking for is how many Parent transactions were profitable and how many lost money

Any help is greatly appreciated

Thanks in Advance,

Isaac

• ###### 1. Re: Count number of records based on a condition

Hi

see the attached

will return this

Jim

If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

• ###### 2. Re: Count number of records based on a condition

Hello Jim,

Thanks, however the final output I'm looking for is the count of green and orange values as in the screenshot uploaded in my first post  (14 green and 9 orange)

The number is defined by the sum of the sub-transactions, for example 387 has three sub-transactions the sum of all the three is not profitable

Regards,

Isaac

• ###### 3. Re: Count number of records based on a condition

sorry

see the attached

this determines the parent pl

this labels it

this is the detail viz

and the summary

Jim

If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

1 of 1 people found this helpful
• ###### 4. Re: Count number of records based on a condition

Hi Isaac & Jim,

Apologies if jumping in (please give Jim the credit ) but I think if the calculation is done individually for each 1 for Profitable and 1 for Non-Profitable and then instead of SUM use COUNT you should get the following:

2 of 2 people found this helpful
• ###### 5. Re: Count number of records based on a condition

Thanks Jim and Don, you were really helpful

Regards,

Isaac

• ###### 6. Re: Count number of records based on a condition

Sure can - there is usually more than one solution to a problem in Tableau

Jim