To say what would have happened but didn't, put the condition in the pluperfect subjunctive (hubiera/hubiese + participle) and the result in the conditional perfect (habría + participle). Either half can come first.
Examples
- Si hubiera sabido la verdad, no habría aceptado el trabajo.
- If I had known the truth, I wouldn't have taken the job.
- Habríamos llegado a tiempo si no hubiese habido tanto tráfico.
- We would have arrived on time if there hadn't been so much traffic.
- Si me lo hubieras dicho antes, te habría ayudado.
- If you had told me earlier, I would have helped you.
The mistake to avoid
Never put habría after si - the condition takes hubiera/hubiese, only the result takes habría.
Where this fits in
Reflexionar sobre la vida, Spanish B2: Narrate formative experiences, express regrets, and report what others said using the pluperfect, conditional perfect, pluperfect subjunctive, and indirect speech.