Hide a field on a user profile if the logged in user has a specific role I have many fields added for users. What I want is the following:
If the logged in user has a role W and is viewing a user page that belongs to a user of role X then show field Y. Otherwise, field Y should not be visible.

I have tried using a a module named "Field Formatter Conditions" that supposedly has rules integrations and offers the Event: A field is being rendered and the Action: Hide a field. However, when I select the action to hide the field, There is nothing to be configured and I just get the save button.

Kindly suggest how I can accomplish the target and I prefer if the solution is based on rules.
You need to download and install module Field Permissions as suggested by @Pierre. 

Then click on configure link:


Here you will find that Y field on which you want to apply permissions:



Then click on User link and you will be redirected to a form:



Here you can add custom permissions like I did.