When Jacob arrived in Egypt, Joseph presented him to Pharoah. Jacob blessed Pharaoh that the Nile River should miraculously overflow when he approached it. As a result of this blessing, the predicted seven years of famine ended after only two years. As he promised, Joseph settled his family in the province of Goshen.
Joseph provided for his father and his brothers and his father's entire household.
Joseph taught us to repay evil with goodness, just as he did with his brothers, sustaining them for the rest of his life. He was able to forgive his brothers not only because he was a master of self-control, but chiefly because he understood the nature of human evil. As we have seen, the brothers' evil act of selling him into slavery served G-d's plan that Joseph eventually become viceroy of Egypt. Joseph focused on the positive outcome of his brothers' acts rather than on their evil essence.
Similarly, we ask G-d to treat us like Joseph treated his brothers, perceiving our misdeeds as being ultimately for the good and responding to them with kindness. In order to "inspire" G-d to see our misdeeds as being ultimately for the good, we must first do the same ourselves, by utilizing our misdeeds as motivation for self-improvement. The misdeed that fuels this transformation thus becomes a merit, retroactively serving a good purpose.
We can further enhance our ability to transform our own misdeeds into merits by training ourselves to see other people's offenses as potential merits, as well.
From Daily Wisdom