Reference: al-Akhlaaq was-Siyar – Ibn Hazam al-Andalusee
Ibn Hazam al-Andalusee (rahima-hullaah) mentions:
When you compare yourself with others in matters of wealth, position, and health, you should look at people less favoured than yourself. When you compare yourself with others in matters of religion, knowledge and virtue, look at people who are better than yourself.