Coloring the rows depending on a particular column's value

I am trying to color each row separately depending on the value of fact for each one of them. Instead, all I manage to do is to turn the whole table grey. I guess that the last value if fact is 'N' and so the last if is in effect. How do I cope with this?
Below is my code.