With reference to the question how to remove sum label from query, I have a similar situation.
Where would I put the LABEL sum(E) in this formula?
=if(($B2="weekday"), ifna(QUERY('Base Data'!$A:$G, "select sum(E) where B = '"&D$1&"' and G = '"&$A2&"'",0),"") , "")