How to do it…

  1. Open the Data model viewer. The data model is shown in the following screenshot. We can see that the EmployeeSalary table is not linked to the data model. If we try to link the table through the EmpID field, then the employees who have changed their positions would reflect the same salaries for each position, which is not correct.
  2. Open the App overview and create a new sheet. Drag a Table object onto the
    content area.
  3. Add the following dimensions to the table: EmployeeID, EmployeeName, Position, PositionFrom, and PositionTo.
  4. Under Sorting, promote EmployeeName to the top. Promote PositionFrom to the second position and set the sort order as numeric and Ascending:
  1. In the preceding script, Susan Sayce has changed her position from HR Analyst to HR Director. There is a DateInToPosition value associated with each position, which comes from the EmployeeSalary table.
  2. We will make use of the IntervalMatch function, which will match the DateInToPosition to the date interval of PositionFrom and PositionTo.
  3. Load the following script on a separate section:
// === Link Table using the IntervalMatch prefix === 
LinkTable: 
IntervalMatch (DateInToPosition,EmpID) 
Load distinct PositionFrom, PositionTo, EmployeeID AS EmpID 
Resident EmployeeInt; Left Join (EmployeeSalary) Load EmpID, DateInToPosition, Autonumber(EmpID & '-' & PositionFrom & '-' & PositionTo)
AS DatePositionKey Resident LinkTable; // ============ Cleanup ============ Drop Table LinkTable; Drop Field EmpID;
  1. On the final load, the data model should look like this:
  1. Open the App overview via the navigation dropdown in the top-left corner. Go back to the sheet created in Step 2.
  1. In the Table object, add the following measure and label it Salary:
Sum(EmployeeSal) 
  1. Make sure that the sorting order remains the same as mentioned in Step 4, that is, to promote EmployeeName to the top. Promote PositionFrom to the second position and set the sort order as numeric and Ascending.
  2. The resultant table would look like this:
  1. Select a particular employee to see all the associated positions, start dates, end dates, and salaries.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset