Just to add to what others have said about factoring in the time to/from the station - something to keep in mind is that Edinburgh doesn’t really have commuter trains. So unless your work would be near Waverley or Haymarket stations, you’d need to get a bus or tram.