Iโm trying to come up with an expression that counts the number of related trainees that have a status of โactive approvedโ. The below expression doesnโt work because Iโm not sure how to โdereferenceโ or whatever you call it the [current status] column within the individual related trainee records. Please advise.
count(select([Related Trainees], ([current status]=โActive Approvedโ)))
Solved! Go to Solution.
Try:
count(select([Related Trainees][_ROWNUMBER], ([current status]=โActive Approvedโ)))
Where are you applying this formula? To a column or a name of a view?
This is just a virtual column.
Can you please explain it further? What table are you into? Are in the related trainees or other table?
The table the virtual column exists in contains a reference to the trainees table. There is a โrelated traineesโ column as per usual, which contains that list.
Here is what I understand with your post and replies. There is a TABLE called TABLE 1 (I just named it), which has a reference table on it called RELATED TRAINEES. Is that correct?
Try:
count(select([Related Trainees][_ROWNUMBER], ([current status]=โActive Approvedโ)))
Interesting! Iโve always used SELECT(TableName[ColumnName],...)
.
I didnโt realized you could use SELECT([Ref_Rows][ColumnName]...
!
See Constructing a List from a List Dereference here:
That worked. Letโs take it a step further now. I want to add the total number of โactive approvedโ trainees to the number of โgraduateโ trainees that graduated in the current year.
count(select([Related Trainees][_ROWNUMBER], ([current status]=โActive Approvedโ))))+count(select([Related Trainees][_ROWNUMBER], (and([current status]=โGraduateโ, year([graduated])=year(now()))))
The system basically ignores the second part altogether, stopping with only evaluating the first โcountโ function. No errors, just ignores itโฆ?
Is that your actual expression? The parentheses are mismatched. Try this instead:
count(
select(
[Related Trainees][_ROWNUMBER],
([current status] = โActive Approvedโ)
)
)
+ count(
select(
[Related Trainees][_ROWNUMBER],
and(
([current status] = โGraduateโ),
(year([graduated]) = year(now()))
)
)
)
-Regardless of my usage of parenthesis or matching Steveโs, the expression ignores the plus sign and everything after it. It does not generate an error, it simply does not even consider it.
-I decided to create an additional virtual column just for the second expression:
count(select([Related Trainees][_ROWNUMBER], (and([current status]=โGraduateโ, year([graduated])=year(now())))))
-The first virtual column works fine (where weโre just counting active trainees). The new column, with the โcurrent yearโ grad count, does not. It generates no error, but it returns no results (always zero). The parser may be having trouble with it because this is what the parser shows, which seems awkward:
COUNT(
โฆThe list of values of column โ_RowNumberโ
โฆfrom rows of table โTraineesโ
โฆwhere this condition is true: (ALL these statements are true:
โฆ1: (The value of column โCurrent Statusโ) is equal to (โGraduateโ)
โฆ2: (YEAR(
โฆThe value of column โGraduatedโ)) is equal to (YEAR(
โฆNOW()))))
Please post a screenshot of the complete expression.
I actually scrapped it and retyped it and suddenly the parser โlikedโ itโฆ?
User | Count |
---|---|
35 | |
34 | |
26 | |
23 | |
18 |