Count total enums

Hi

Im trying to create a simple app. I have 3 tables: Customers RAN, Customers BAM and Products

In the form of Customers RAN i can select via dropdown a product. and with a dropwdown i can select if i have given away a product or not. 

IDName CustomerProductProduct given away?
1Cust 1Product AYes
2Cust 2Product BNo
3Cust 3Product AYes
4Cust 4Procuct CYes

In the form of Customers BAM i can select via dropdown a product. and with a dropwdown i can select if i have given away a product or not. 

IDName CustomerProductProduct given away?
1Cust 1Product CYes
2Cust 2Product BNo
3Cust 3Product AYes
4Cust 4Procuct CYes

In my other table called products i want to show data based, on the table Customers RAN and Customers BAM,  how many products i have given away (so count value "Yes" of the product and  If value no is selected than it will not to anything and will be 0):

IDProductTotal product given away
1Product A3
2Product B0
3Product C3

What formula can i use in appsheet to show the result in the field Total product given away based on the Product field ?

Best regards,
Zuha

0 2 62
2 REPLIES 2

Hello, haven't test it yet. Just want help and give it a try. Hope it would work

Count(SELECT(Customer BAM[Product],
AND(
[Product] = [_THISROW].[Product],
[Product to be given away?] = "YES")
+
Count(SELECT(Customer RAN[Product],
AND(
[Product] = [_THISROW].[Product],
[Product to be given away?] = "YES")

 

First, I recommend NOT having Customers RAN and BAM in different tables.  Place those rows in a single table (Maybe named "Give Aways", add a column to identify RAN or BAM, and then use either Security Filters OR Slices to filter the rows depending on the view security you are attempting to achieve.  

Then in your Products table you will have a very simple expression in the "Total Product Given Away" column:

COUNT(SELECT(Give Away[ID], 
AND([Product] = [_THISROW].[Product],
[Product Given Away?] = TRUE)
))

NOTE:  There recently has been some question about the usage of "Yes" in a Yes/No column.  I suggest using TRUE.

Top Labels in this Space