Hi. I want to make an expense tracker app. This screen is dashboard screen and i want to display the balance by (totalIncome) - (totalExpense). All the data has been input and saved in the Google Sheets. I attach a photo of the blocks and the sheets.
The problem is, the global totalIncome and global totalExpense just take the values of the last row/new input. For example, when input is (Expense,80). The totalExpense is 80 while the balance become -80 because income is 0.
You can save those split blocks if you use the block "list from csv table". You will have a list of rows, then you can do something similar you are doing. Check for each row if it is an income or an expense, to add it.
You could use a gviz query on your google sheet to return the sums of your expense and income
https://docs.google.com/spreadsheets/d/1YUd64vf8BeLbBFoyz18ElAcwZz8bIPCNsiPOGX1U/gviz/tq?tqx=out:csv&tq=SELECT SUM(A) WHERE B = 'income'
https://docs.google.com/spreadsheets/d/1YUd64vf8BeLbBFoyz18ElAcwZz8bIPCNsiPOGX1U/gviz/tq?tqx=out:csv&tq=SELECT SUM(A) WHERE B = 'expense'