There is a difference between a table and a table occurrence. When you set up a calculation field, you first select a "context" table occurrence in the context drop down at the top of the dialog. Then, when you refer to fields from a different table, you use this syntax: tableoccurrenceName::fieldname. If there is no valid relationship between the TO selected in the context drop down and the TO specified as part of the field reference, you will get that error.
This can also affect what you see in a portal since the portal specifies a table occurrence in portal setup | Show Related Records From and if you then select fields from an unrelated Table occurrence, no data will appear in that field if you place it in the portal row. The Layout is also based on a table occurrence specified in Layout Setup | Show Records From.
For more about table occurrences, see: Tutorial: What are Table Occurrences?