The present report summarizes three recent CMS results on Heavy Flavor production, fully or partially exploiting the data collected at LHC with proton-proton collisions at the center-of-mass energy $\sqrt{s}= 13$ TeV.
Firstly, a measurement of the prompt open-charm differential production cross section is performed on $29$ nb$^{-1}$ of data collected in 2016. The CMS results are compared to a few theoretical calculations and to previous measurements by other experiments at the LHC in different kinematic ranges.
Secondly, the observation of two $B_c$ excited states by CMS, $B_c(2S)^+$ and $B_c^{*}(2S)^+$, has been recently followed by the measurement of their relative production cross sections using $143$ fb$^{-1}$ of data collected during the whole LHC Run-II (2015-2018). The dependence of the cross sections on the transverse momentum and the rapidity of the ground state $B_c$ is studied along with the dipion invariant mass distribution.
Finally, a fiducial cross-section for $\Upsilon(1S)$ pair production is measured using $35.9$ fb$^{-1}$ of data collected during 2016.
The contribution of double-parton scattering (DPS) to the total inclusive $\Upsilon(1S)$ pair production cross section is also measured for the first time in the same fiducial region.