Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Count of PersonId that have Flag A and B

Hello,

I want to know the number of people that have a common A and B as Flags, each person can have multiple As and/or multiple Bs (and also he can have As without B's and vice versa). This table shows some the data:

PersonID | Flag | Field1 | Field2 | Field3

12           | A     |

12           | A     |

13           | B     |

14           | B     |

15           | A     |

15           | B     |

16           | B     |

17           | A     |

12           | B     |

12           | A     |


The result of the count should be 2 because 12 and 15 are the only personID that have records with Flag A and B.


How to obtain this?


1 Solution

Accepted Solutions
jpenuliar
Partner - Specialist III
Partner - Specialist III

maybe this :

=count({<PersonID = p ({1<Flag = {'A'}>}) * p ({1<Flag = {'B'}>}) >}DISTINCT PersonID)

View solution in original post

2 Replies
jpenuliar
Partner - Specialist III
Partner - Specialist III

maybe this :

=count({<PersonID = p ({1<Flag = {'A'}>}) * p ({1<Flag = {'B'}>}) >}DISTINCT PersonID)

Not applicable
Author

Thanks! it worked