The rule of good moral character to get Cancellation of Removal is has two parts.
The first thing to prove is that you're not disqualified by a statutory bar from demonstrating good moral character. A statutory bar occurs when you have a conviction for certain crimes, or if Immigration has reason to believe that you are a drug trafficker.
Some particularly severe crimes can bar you from getting cancellation no matter when they took place. This usually happens if you have a conviction for murder or an aggravated felony, or if you've engaged in persecution, genocide, torture, or violations of religious freedom.
The remaining bars apply only if the act occurred during the ten years the law requires for good moral character.
The second thing to remember is that even if you show that you are not barred under the statute, you still have to convince the judge that you have good moral character as a matter of discretion.
The statute allows the immigration judge to consider other negative factors besides the crimes mentioned. If you have negative factors you must prepare an explanation of the circumstances. Then you must convince the Judge that it will not happen again.
The judge needs to weigh these negative factors against the positive factors you need to prove. This is referred to as a “balancing test”