SUM Expression: How to SUM from two tables?

Hello!

I would like to know if I can SUM up these two as one.
(SELECT(PARTICIPATION[Dosage],[Student ID]=[_THISROW].[Student ID]))
(SELECT(REFERRAL[Dosage],[Student ID]=[_THISROW].[Student ID]))

Please advise. Thank you.

Solved Solved
0 8 792
1 ACCEPTED SOLUTION

You should be able to read it directly from related child virtual lists like…
SELECT([RelatedParticiptions][Dosage],TRUE)+SELECT([RelatedReferrals][Dosage],TRUE)

View solution in original post

8 REPLIES 8

@Kevin_Chan

(SELECT(PARTICIPATION[Dosage],[Student ID]=[_THISROW].[Student ID])) + (SELECT(REFERRAL[Dosage],[Student ID]=[_THISROW].[Student ID]))

WOW! I have been trying with the AND () and I couldn’t make it work but you added a “+” and it works. Thank you.

You’re welcome @Kevin_Chan

Btw… do you have relationships between these tables?

@Aleksi Based on this, it looks like these two tables have relationships. Correct me if I’m wrong.

You should be able to read it directly from related child virtual lists like…
SELECT([RelatedParticiptions][Dosage],TRUE)+SELECT([RelatedReferrals][Dosage],TRUE)

@Aleksi, I tried your expression and yes it works. Thank you.

With that syntax you don’t need to read two tables totally. You only need to read the virtual related records list.

Top Labels in this Space