Av Harachamim is a prayer written in response to the First Crusade. It was, at first, only recited the Sabbath before Shavuos, which was during the tragedy of the First Crusade (Zevin, p. 607).
Because the prayer was written in response to the tragedy in Western Europe, its recitation was never picked up by the Jews in Islamic lands, and they still do not say it. In Western lands, though, the prayer is now said most Sabbaths of the year. The only times it is omitted are certain joyous occasions -- although customs vary widely as to exactly which occasions are considered joyous enough. All agree, though, that on certain occasions Av Harachamim is not recited, unless such an occasion happens to occur during the period before Shavuos, in which case the prayer is recited, as the period before Shavuos is when the tragedy occurred.