You have valid dates?
For debugging purposes I’d suggest you create the string first i.e.
local query = '[[SELECT SUM(incomeValue) FROM income WHERE timeStamp > "]]..seven_days_ago..[[" AND timeStamp < "]]..now..[["]]'
print(query)
db:exec(query, getData)
print(weekIncome)
If unable to resolve upload your .db file and I’ll have a look.