The Shulchan Aruch (OC 580:2) says that the day a Tzaddik was niftar is a fast day such as Adar 7 for Moshe Rabbeinu. Yet Lag BaOmer, the yahrtzeit of Rebbi Shimon Bar Yochai is a day of happiness. What is the difference. The Sefer Ohr HaYikod Heim Yokdim gathered a list of reasons. Among them include,
1. Rebbi Shimon himself called it Yom Simchaseinu. The Shach paskens (YD 344:9) that if someone requests not to mourn him on his yahrtziet we listen to him. Rav Chaim Vital says that Rebbi Shimon appeared to the Arizal and complained of someone saying Nacheim on his yahrtzeit.
2. Moshe Rabbeinu did not fulfill his dream of bringing Bnei Yisroel into Eretz Yisroel. Rebbi Shimon was very happy about the day of his petira.
3. When Moshe was taken, 3,000 halachos were forgotten. When Rebbi Shimon was niftar, many Sodos HaTorah were revealed in the Idra Zuta.
4. Lag BaOmer we celebrate that Rebbi Shimon eluded death at the hands of the Roman emperor. it was only celebrated after his petira in order not to anger the Romans. The day of his petira was the appropriate day since had he been killed by the Romans he would not have been buried.
5. Death of a tzaddik causes a celebration in Shamayim and mourning on earth. When Rebbi Shimon was niftar the celebrations in Shamayim were revealed to the world, and all partook in the simcha.
6. Rebbi Shimon left behind a son worthy of filling his role. Moshe Rabbeinu did not.