As shown in recent years, introducing exogenous elements (M) into nitrogen materials under pressure can form new multi-nitrogen structures (MNx) which are more stable and have milder synthesis conditions than pure nitrogen structures. We used the structure prediction software to search for the optimized components of transition metal yttrium nitrogen compounds, as well as for the stable crystal structures, by changing the chemical ratio and pressure conditions. We have predicted the six structures of yttrium nitrogen compounds: P1YN4, C2/m-YN5, YN6 (C2/c phase, C2/m phase, P1 phase) and P1-YN7 under high pressure conditions, among them, the C2/c-YN6 and P1-YN7 are newly discovered in this paper. It was found that C2/c-YN6 and P1-YN7 can be synthesized by YN + N2 at high pressure. Molecular dynamics calculations show that the two structures are stable at high temperature. The structure analysis shows that the nitrogen atoms in the two structures are connected alternately by nitrogen single bond and nitrogen double bond, which is beneficial to energy storage of the structure. The energy density of these two structures is comparable to that of TATB and RDX, and the explosive velocity and explosive pressure are higher than those of TNT and HMX, so these two structures could be used as potential high energy density materials. The predicted structures of C2/c-YN6 and P1-YN7 may provide new clues for synthesis and exploration of novel stable polymeric nitrogen.