R Jack Abramowitz clarifies (here) the distinction between the permitted and forbiddden part of the melacha of boneh (assembling or building)
While the av melacha (primary labor) involves both assembling separate
pieces into a unified whole and forming a shelter, either activity is
prohibited on Shabbos, even if the other is not accomplished.
Accordingly, one may not pitch a tent or throw schach on the roof of a
Succah (forming a shelter in the absence of assembling pieces).
Likewise, one may not put together pre-fabricated furniture (such as one might get at Ikea), even though doing so does not create a
shelter. Even screwing the handle into a broom is assembling and
Home repairs are included under the melacha of boneh, as one is not
permitted to add to an existing structure on Shabbos. Driving a nail
into a wall for a picture hook or laying tile are adding to the
building and therefore boneh. It is not boneh, however, when an action
reflects an object’s normal mode of use. Therefore, if a sliding door
comes off its track, it may be replaced. Similarly, one might replace
the spring-operated dispenser that holds a roll of bathroom tissue.
While one may not assemble furniture or other utensils on Shabbos, one
may open and close folding objects such as tables, chairs, portacribs
and strollers. One may not use an umbrella on Shabbos, however,
because it creates a shelter.
(see also Halachipedia).
Note that the melacha of makeh b’patish (rendering something fit for use for the first time, see e.g., here) is another reason not to build furniture.
Bottom line: most IKEA furniture cannot be assembled on Shabbat and a rav should be asked in specific cases of emergency.