LOOKUP items from a list
This example shows how to look up salaries from a list, Grades, and populate the Employee Salaries module with salaries.
Source list property
The Grades list has a property called Salary, which is formatted as Number. The Grades list looks like this in Grid View:
The Employee Salaries module has the Employees list on the rows and two line items on the columns called:
- Grade, a List data type on the Grades list.
- Salary, a Number data type, with this formula:
In the Employee Salary module, when you select the grade for an employee, the Salary field is populated with the corresponding value from the Grades list.
LOOKUP example using multiple mappings
Say you want to look up the salary for employees. You have a Pay table module based on grade and region and you want to display the salary in an Employee salaries results module.
The mapping between source and results modules is done on Region and Grade.
Region and Grade are dimensions in the source module, Pay table. They're also list data type line items in the results module, Employee salaries.
For the results module, LOOKUP uses the mappings for Grade and Region to return employee salaries from the source module Pay Table, and the line item Basic Pay.
The formula used to get the figures in the Salary column is:
Pay Table.Basic Pay[LOOKUP: Grade, LOOKUP: Region]
The source module, Pay Table, has a line item on pages, Basic Pay, which has a number data type. It has the Region list on columns, and the Grades list on rows.
This table shows the data for the Basic Pay line item:
|Region A||Region B||Region C||Region D|
The Employee salaries module has the Employees list on rows, and the following line items on the columns:
- Grade, a list data type on the Grades list.
- Region, a list data type on the Regions list.
- Salary, a number data type, with the formula:
Pay Table.Basic Pay[LOOKUP: Grade, LOOKUP: Region].
The table shows the Employee salaries module. When the Grade and Region is selected for each employee, the Salary value is populated for the employee by the LOOKUP formula.
|Employee x||Grade 2||Region B||31,000|
|Employee y||Grade 3||Region C||45,000|
|Employee z||Grade 3||Region A||40,000|
LOOKUP example using time periods
This example shows you how you can use LOOKUP on a time period. You have a source module, Pay region, and a results module, Staff costs. You look up the staff costs in the Pay region module, and map the costs by Region and Period.
LOOKUP and time periods
You can use LOOKUP when the source line item is a finer timescale than the mapping line item data type. Similarly you can use LOOKUP when the dimension of the target line item is a finer timescale then the dimension of the mapping line item.
However, if the time scale that you use in the results does not exist in the source, then LOOKUP returns zero. For example if you select Half-year totals in the results but it is not selected in the source, LOOKUP returns zero.
The source model, Pay region, has a line item on pages, Pay, which is formatted as a number. It has the Regions list on columns, and the Time dimension on rows.
This table shows the data for the Pay line item:
The results module, Staff costs, has the following line items on columns:
- Regions, a list data type on the Regions list.
- Period, a Time Period data type with Month selected.
- Costs, a number data type with the formula:
Pay region.Pay[LOOKUP: Regions, LOOKUP: Period]
The Transactions list is on rows.
This table shows the Staff costs module.
|Transaction 03||Asia Pacific||Jan||129,333|
You can see that the values in the Costs column come from the Pay region source table. For example, the Transaction 01 value 166,833 comes from the cell at the intersection of Europe and Jan.