How to programatically add a pseudo field to views and display the field value based on value of other field?
In addition to the preprocess hook approach noted in the comments, you may want to use:


Computed Field Module https://www.drupal.org/project/computed_field
Views PHP Module https://www.drupal.org/project/views_php