How do i relate columns (or values) of other tables?

Hello guys!
I need help on this:
I have several tables (5) the main one (PAIN EVENTS) and another 2 of them are MEDICATION AND RESCUE MEDICATION.
In the main one I list the other two in columns.
In the medication tables, in both, I have added a rollup column that makes me the sum of the total pills that you have entered …

QUESTION: I would like to have another TABLE that will add both columns of the MEDICATION table AND the RESCUE MEDICATION table. (From the rollup of each one of them …)
But it tells me … “you need a link field to create a rollup”
AND I’M ALREADY LOST.
I have also tried in formulas:

in formula … SUM () how do I enter the values ​​that the rollup columns of other tables give me? In parentheses. Can be done?

Anyway that’s my problem now.

Thanks.