stevenal,
I believe you mean sinusoidal PF = |cos(90-atan(kWtotal/kVARtotal))|
The 90-atan(kWtotal/kVARtotal) would be the actual phase angle. Use absolute value around the cosine because you cannot have a negative PF.
That PF formula works ok with wattless reactive power until you introduce...