One of the signs of considerate etiquette is to let your host know if you cannot attend an event
Earliest is best
Even if something important comes up at the last minute it is always the polite thing to do to notify your host even at the last minute or after the event