Counting selected records in a child table

I am working on my first AppSheet app. 

I have a table called Events that has a child table called EventDetails

The key field for Events is [Row ID], the label field is [EventID]
The key field for  EventDetails is [Row ID] and it has the field [EventID] of type Ref that refers back to Events, and the [Status] field that holds one of 3 enumerated values (Yes, No, & Maybe).

The intent is to have a 1-to-many relationship between Events and EventDetails.

What I am trying to do is: for each event I want to count how many records have [Status]="Yes". 

To do this, I created a Virtual Column in the Events table called [YesCount]. The app formula for the column is:

count(Filter(EventDetails, and([Status] = "Yes", [EventID]=[_THISROW].[EventID])))

The results in the value 0 (even though there are Yes records. 

When I use this expression:

count(Filter(EventDetails,  [EventID]=[_THISROW].[EventID]))

I also get the value 0. 

There are definitely appropriate records in EventDetails. What am I missing?

0 1 140
1 REPLY 1

I use this to count the number of records in the child table:

count(REF_ROWS("FarmMargin","ProdRequestID"))

I use this to count the number of records that have been responded to:

count(
FILTER("FarmMargin",
  AND([ProdRequestID]=[_THISROW].[ProdRequestID],
  isnotblank([GMApproval])
  )))
 
Hope that helps!

 

Top Labels in this Space