Sum of item from another table that matches this row

Using a virtual column in the table โ€œConsoleโ€ I want to sum the value of [Total_11] from the table โ€œAppQuotes.csvโ€ which matches this [JobID], I thought the following formula would do the trick but it returns an error, Invalid App Formula. Can anyone help with the syntax?

SUM(AppQuotes.csv[Total_11],[JobID]=[_THISROW].[JobID])

Kind Regards

0 16 3,839
16 REPLIES 16

Hi @Dave_Willett,

You may wish to try an expression something like below

SUM(SELECT(AppQuotes.csv[Total_11] , [JobID]=[_THISROW].[JobID]))

Basically, you will need a SELECT statement to compose a list all values from the column
[Total_11] matching the criteria denoted by [JobID]=[_THISROW].[JobID] . The SUM statement then will add all those values in the list.

It's not working in physical column & virtual column data not recorded in database. So please help on this.

Just FYI, itโ€™s advisable to remove any special characters from your table & column names.
2X_7_7e54f122633bb536efd661b705870088baa3bb6d.png

You mean the โ€˜.csvโ€™ ?

That seems to work Suvrutt, thank you

Not necessarily the whole โ€œ.csvโ€ but the dot. Same for any of the other special characters (., ], [, , /, etc.).

Point taken, I am rigid with naming convention in VB6 and Access VBE, just wasnโ€™t sure with using Appsheet, Iโ€™ll get there.

AppSheet has compensated in most places, especially in the editor, to handle special characters; itโ€™s when you get to workflow templates and other integrations that the magic of appsheet fades away.

@Dave_Willett Just curiousโ€ฆ are you using references betweeen these two tables?

Hi Aleksi. If I think what you mean Iโ€™m using the formula to pull data from another table and showing the result in a view, the Show_If becomes very useful to hide zero data and a pretty nice front end.

Are you using Ref field for that purpose?

The formula is in a Virtual Column in table โ€œConsoleโ€:

Then pulled through a slice and eventually used on the form โ€œHomeโ€:

Resulting in a total on the form:

Is this what you meant?

For me it sounds you could make the calculation like SUM([Customer Quote][Total_11]). The reason is thisโ€ฆ because you already has a virtual list โ€œCustomer Quoteโ€, you donโ€™t need to read the whole AppQuotes.csv table again. You can just read the sum from that virtual list.

Interestingโ€ฆ Iโ€™ll do some testing later. Thank you for the advice Aleksi, always appreciate wisdom from you guys.

Kind Regards

HI
Iโ€™m writeed that code. but dond worked. I think because the data saved in main table before sub table. please I want help
SUM(SELECT(purchases_Details[total_amount] , [invoice_number]=[_THISROW].[invoice_number]))
thanks

Try instead:

SUM([Related Purchases][total_amount])
Top Labels in this Space