Using data from direct numerical simulation (DNS) of incompressible and compressible channel flow, we develop a method of sub-ensemble decomposition to investigate the pressure gradient effect on the Karman constant and the additive constant B characterizing the mean velocity profile (MVP). The sub-ensemble decomposition is defined according to the magnitude of vertical fluctuation velocity, which mimics coherent motions like ejection and sweep. DNS data analysis shows that each sub-ensemble displays a distinct Karman constant, with a variation which mimics effects of pressure gradient. The latter is demonstrated by a relation between sub-ensembles’ κ m and B m similar to empirical data under various pressure gradients. A set of global parameters, κ 0-pg=0.39 & B 0-pg=5.5, are then derived for interpreting two constants observed by Nagib et al.