Prevent a duplicate of a certain value

I have a unique issue. I have  a contact table that has records ID, AcctNum, Primary, Name....

Primary is Yes/No

I need a way to only allow  a record to be only 1 Primary per Acct and as many No as needed

For Example 

ID   AcctNum       Primary         Name
22YesTest 1
32NoTest 2
42NoTest 3
52

Yes
 <<<This needs to fail with Primary Contact already Exists>>>

Test 4

 

0 1 47
1 REPLY 1

Hi

 prevent duplicates

NOT(
  IN(
    [_THIS],
    SELECT(
      table[column],
      ([KEY] <> [_THISROW].[KEY])
    )
  )
)

https://www.googlecloudcommunity.com/gc/Tips-Tricks/Maintaining-Unique-Entries/m-p/263724

 

Top Labels in this Space