Sum of numbers by employee ID

I have some code that is green checked but returns the value of 0

I have 2 tables, one named “Main” and “Employees” and they are referenced by a field employee ID in both tables.

In the “Employees” table I have a column with a bunch of numbers in it and I would like the sum to be displayed in a virtual field on “Main”. My code looks like this

SUM(
SELECT([Related Employees][Days],
AND([Description_DSP_DS] = VAC , “Employee ID” = [Employee ID])
)
)

The code is correct and the description seems correct but it returns 0. For example

Employee Type Days

123456 VAC 5

654321 SIC 2

123456 VAC 5

I want a virtual field on “Main” that will say Total VAC Days for 123456 = 10

Thank you!

Please evaluate using

SUM(
SELECT([Related Employees][Days],
AND([Description_DSP_DS] = VAC , "Employee ID" = [Employee ID])
)
)

column name in place of “Employee ID” and you may also need to bring in [_THISROW]

So something like

SUM(
SELECT([Related Employees][Days],
AND([Description_DSP_DS] = “VAC” , [Employee ID] = [_THISROW].[Employee ID])
)
)

1 Like

I tried adding [_THISROW] and the column name is “Employee ID” and still the result is 0 when the result should be 10

please evaluate it in steps.

Is SUM( [Related Employees][Days]) returning a summed value for example?

1 Like

Yes, that returned a sum of all the days column

1 Like

I got it figured out, took off the quotes and referenced a column and it worked. Thank you!

2 Likes