How is goodwill calculated in a step acquisition under IFRS 3?

Under IFRS 3 Business Combinations, a step acquisition requires a remeasurement of any previously held equity interest.
Goodwill is the aggregate of the fair value of total consideration transferred at the date of acquistion (so the prior holding in a step acquistion will need remeasuring) and the Non-Controlling Interest less the fair value of net identifiable assets acquired.
Any gain or loss arising from remeasuring the previously held equity interest to fair value at the acquisition date must be recognized immediately in profit or loss.