For testing an array you can use if(Array.isArray(msg.payload) && msg.payload.length)
This ensures the variable is an array && that it has 1 or more items.
msg.payload isn't part of the equation as I see it.
msg.month will be set. That is set by the upstream node to set the month value for this month.
It is just the array msg.table which may not be set/defined and that is generated upstream too.
I may look at how it is set and do a condition there. But at the end of the day, it needs to be done somewhere and due to recent observations here is as good a place as any to check/test for it being set and if not, set a default value.
Less nodes needed/used.