In details window, select resources needed to complete the task.
For human resources, the Units coefficient shows the fraction of its working program dedicated to the current task (e.g. if the resource has an 8 hours per day program and you set 0.5 units, the resource will spend 4 hours per day working at that task).
For materials, Units gives the quantity needed to complete the task.
While assigning resources, the work on task is displayed at the bottom (also in the table, Work column).
To keep the work and modify the duration when changing resources (assign a new resource, remove a resource, change the units for an assigned resource), just mark the Try to keep the work when changing resources/duration (make task work-driven) checkbox (also at the bottom side).
The work needed to complete a task can be changed in the corresponding column of the table. In this case, the task duration will be changed to accomodate the work and the assigned resources.