In this paper, we investigate the invariance of the arithmetic mean with respect to generalized quasiarithmetic means, that is, solve the functional equation \(\begin{aligned} & \left( \frac{f}{g}\right) ^{-1}\left( \frac{\int _0^1f(tx+(1-t)y)d\mu (t)}{\int _0^1g(tx+(1-t)y)d\mu (t)}\right) \\ & \quad + \left( \frac{h}{k}\right) ^{-1}\left( \frac{\int _0^1h(tx+(1-t)y)d\nu (t)}{\int _0^1k(tx+(1-t)y)d\nu (t)}\right) =x+y,\quad x,y \in I, \end{aligned}\) where \(f,g,h,k:I\rightarrow {\mathbb {R}}\) are four continuous functions, g, k are positive, f/g, h/k are strictly monotone, and \(\mu , \nu \) are probability measures over the Borel sets of [0, 1].