The present invention relates to a novel imidazotriazinone or imidazopyrazinone derivative, a tautomer thereof, a stereoisomer thereof and their mixture, or a pharmaceutically acceptable salt thereof and a pharmaceutical composition for preventing or treating a tankyrase-related disease, which contains the same as an active ingredient.