23.2 Linking Units to Tables¶
A unit's lookup table defines its values. To analyze facts by the unit, every table that contains the key – e.g. the customer number in the invoice lines – must be mapped to the unit. Mapping is what connects facts and dimensions.
Mapping a Field to a Unit¶
In the Warehouse diagram:
- Drag the unit from the Object Tree onto the field in a table – or the field onto the unit. The status bar tells what will happen, e.g. Map dimensional unit 'Customer' to field 'Sell-to Customer No_'.
- Or select the unit in the Object Tree, then right-click the field → Map to ….
Mapped fields show the unit icon. Right-click a mapped field → Delete mapping to … to remove it.
A field can be mapped to one unit, and a unit to one field per table. If you map a unit with no ID yet, Modeller offers to use the field as its definition field.
Mapping to All Matching Tables¶
Map to all... (HOME → Dimensions, or right-click the unit) finds fields with the same name and data type as a field already mapped to the unit, in all tables. Check the list and click OK.
[!NOTE] In the current version OK maps all listed fields, also unticked ones. Review the list carefully, and delete unwanted mappings afterwards.
Shared Dimensions¶
When the same unit is mapped in several fact tables – e.g. Item in sales lines and purchase lines – it becomes a shared dimension: users can compare sales and purchases per item in one table. There is no separate setting for this; mapping is enough.
Checking the Links¶
- Select a unit: the Info panel lists Related to: – every table field mapped to it. Click one to jump to the table.
- Validate reports problems such as No link found between parent … and child unit … or a unit mapped to several fields in one table – see 26.1 Validating the Project.
Common Issues – Linking Units to Tables¶
Problem: A metric shows the same value for every customer. - Solution: The fact table's customer field isn't mapped to the Customer unit. Map it.
Problem: Field '…' is the Definition Field of unit '…'. It is not possible to overwrite this mapping. - Solution: The field defines another unit. Change that unit's ID first if the mapping really should change.
Problem: Data type mismatch in the validation. - Solution: The field and the unit's ID have different data types, e.g. text and number. Map a field of the same type, or convert it in a dynamic view – see Chapter 22.