BAQ calc field, count if value = true?

Hi All,

I’d like to count the number of approved revs via a BAQ. I created a calculated field and used the count function to count PartRev.approved, but found that tells me the total number of revs. How can I count the number of approved revs?

Try SubQuery Criteria

Try a sum instead.
Sum(PartRev.Approved)
If that doesn’t work (but field error), then try:
Sum(case when PartRev.Approved = 1 then 1 else 0 end)

noticed this was E9. sorry if this doesn’t work for you instance.

approved revs total?
select count (*)
from erp.PartRev as pr
where pr.approved = 1

approved by part?
select pr.PartNum, count (*)
from erp.PartRev as pr
where pr.approved = 1
group by pr.PartNum