To calculate internal resistance, we use a potentiometer to first calculate the voltage across the battery, with no current through it. Then we attach a resistor in parallel to the battery and recalculate the voltage across it. Since the current flows, this time the balancing length is smaller. Using the battery equation, we calculate the internal resistance.