In other cases, if you wanted to try custom rom such as Lineage os, Havos os, etc which are rom that entirely different from miui rom, you may need to consider wiping the system partition and others partition *excluding the internal storage *in advanced option.
Somes others cases, format data...