datatable would be your existing load.
//sum(Flag) as Frq,
If(Count(InvoiceNum)>1, 'Yes', 'No') as Duplicate
Resident datatable Group by InvoiceNum;
//if(ApplyMap('Map_Duplicate',InvoiceNum)>1,'Yes', 'No') as Duplicate
//drop Table datatable;
Now I need to filter out all the duplicate PatID s
LIB CONNECT TO [pharmoresql production (pharmore_rwinkel)];
SQL SELECT "FacID",
in the data I pulled a patid will have duplicates that are ok when a patient moves to a new facility they are transferred some I can have a true duplicate meaning I could have five patids the same but all pointing to the correct AR account. PatId = AR account number.
so what my logic is remove all duplicate PatId s then search for duplicate SSN s and all duplicates will be the same patient but with two AR account numbers.
need to limit the false duplicate SSN