First -- the caveat that I'm not a lawyer, I'm not providing legal advice, and you really should discuss legal questions with a qualified attorney in your jurisdiction has to be mentioned.
As a broad, general principle, you are permitted to use the force reasonably necessary to safely resolve a situation. Lots of weasel words in that sentence, huh... Things that matter in the analysis are the routes of escape and how practical escape was, the threat (a machete is a pretty damn serious threat) and how imminent it is (that guy right in front you with a machete versus you in Kansas threatening to cut me in Virginia with a machete... not likely, huh?), instigators/aggressors...
So... could you have inflicted harm on him to stop an attack? Probably. You could probably even justify some degree of preemptive action. But you probably couldn't have justified chasing him down the street to disarm him, unless you can paint the picture in front of a jury that he was still presenting a threat to people at that moment, and you HAD to stop him.
Question, though... why not just retreat into a room, and call 911 or your local police emergency number? It ain't "cool"... but it's a response that keeps you out of harms way, and protects everyone. And you probably avoid the concerns of going to jail... Which is a serious likelihood with any use of force, in any jurisdiction. If you look around, you'll find plenty of threads on it.