Suppose we are given two varieties $X, Y$ over a field $k$ (probably assumed to be projective or proper over $k$). Denote the projections by $p\colon X\times_k Y \rightarrow X$ and $q\colon X\times_k Y \rightarrow Y$ and say we are given a quasi-coherent $\mathcal{O}_X$-module $\mathcal{F}$ and a quasi-coherent $\mathcal{O}_Y$-module $\mathcal{G}$ (probably assumed to be finite locally free or something weaker).
Then we have the Künneth formula, giving us a canonical isomorphism $H^n(X \times_k Y, p^*\mathcal{F}\otimes_{\mathcal{O}_{X\times_k Y}} q^*\mathcal{G})=\bigoplus_{i+j=n}H^i(X, \mathcal{F})\otimes_kH^j(Y, \mathcal{G})$.
Suppose further we are given a (probably proper or some other assumtion) morphism $f\colon Z \rightarrow X\times_k Y$ of varieties over $k$, then we can consider the pullback $f^*(p^*\mathcal{F}\otimes_{\mathcal{O}_{X\times_k Y}} q^*\mathcal{G})=f^*p^*\mathcal{F}\otimes_{\mathcal{O}_{Z}} f^*q^*\mathcal{G}$. I would like to compute $H^n(Z,f^*p^*\mathcal{F}\otimes_{\mathcal{O}_{Z}} f^*q^*\mathcal{G})$; so my question is, if there exists something similar to the Künneth formula in this situation?
My attemt was to write $H^n(Z,f^*p^*\mathcal{F}\otimes_{\mathcal{O}_{Z}} f^*q^*\mathcal{G})=H^n(X \times_k Y, Rf_*(f^*p^*\mathcal{F}\otimes_{\mathcal{O}_{Z}} f^*q^*\mathcal{G}))$ and then use the projection formula, aiming to apply the Künneth formula over $X \times_k Y$. But I was not able to reach a suitable expression in order to apply the Künneth formula.
I am willing to assume some extra assumtions, if needed.