I have a simple spreadsheet that i record my fuel usage on, the last column totals the fuel quantity over a running 12 month period. If uses SUMIFS in Google sheets, but this formula gets overwritten as blank when using my app.
Iโm not sure how to write an expression to do this simple task in AppSheet.
Advice much appreciated
Sum across the last 12 months prior to the current recordโs [Date]:
SUM( SELECT(
Table[Veg Oil Qty] ,
[Date] >= EOMONTH( [_THISROW].[Date] , -13) + 1
) )
Hi, thanks, it says โCanโt find Tableโ
If i assume that is a variable that needs changing to my sheet name it still doesnโt work (โSheet1โ). Have i misunderstood?
Yes you need to change โTableโ to the name of your Table in the app (which could be the same as the Sheet name).
What syntax error am i making here?
What is the name of your Table inside of the app?
Aha, thank you.
That appears to be working, strangely it has now changed the appearance on entries in the app, the โtitleโ of each entry is now that running total instead of the date as before
(iโm not sure why the creator view of the app only shows one entry, the app on my phone correctly shows all 3 entries, but the title issue remains)
Hi Marc, i notice that the running total shown in any given row pertains to the quantity figures up to the previous row.
As shown here, the first three rows still have my original formula in the cells, whereas the fourth entry is the only one after i implemented your expression.
Is there a way for the app to live calculate that total for the number just entered and show it in the total box (and thus enter it into the appropriate cell in the source?
You mean the sum just isnโt including the current record?
yes
I believe the problem is that the expression is running when you are creating the new record. In such a case, the new record doesnโt yet exists in the Table, so the SELECT expression doesnโt pick it up.
You could add a term to the expression:
+
[Veg Oil Qty]
โฆin order to add the current recordโs value to the previous SUM. The problem with this is if you ever edit that record again, the SUM will then be greater than it should be by that recordโs amount. Will you ever be editing the record later?
Thanks Marc, i will give this a test. No, realistically i will not need to edit a record later, once the oil has gone in the tank and been burnt thereโs no going back (unless iโve made a mistake!)
Thanks again, this works a treat
Iโll give it a shot. I think that this is very close to what you want:
Several things I did differently:
Here is how I defined the columns:
Start: EOMONTH( [_THISROW].[Date] , -13) + 1
End: [_THISROW].[Date]
Total:
SUM( SELECT(
Table[Veg Oil Qty] ,
AND(([Date] >= EOMONTH( [_THISROW].[Date] , -13) + 1), ([Date] <= [_THISROW].[Date]))
) )
Hope this helps.
Brian
Thankyou for this.
Now that iโm aware of expressions in AppSheet i do not require the formula in the spreadsheet anyway
User | Count |
---|---|
16 | |
11 | |
9 | |
8 | |
4 |