Financial Management example allocations

The demo data that is available with the Financial Management application provides examples of cost allocations that you can use to model allocation rules, methods, and metrics.

Allocate by number of incidents per caller

This scripted allocation metric queries the incident table and groups the results by the department of the incident caller. It then counts the total number of incidents and weights the departments by the number of incidents. The allocation process creates an allocation line for each department, with the Sales department having the largest number of incidents, using the default demo data.

  • Metric name: Department by number of incidents called
  • Type: scripted
createMethods();
 
function createMethods(){var methodUtils =new FinancialMethodUtils();var methods =[];
 
	//Query the incident table grouped by caller_id.departmentvar ga =new GlideAggregate('incident');
	ga.addNotNullQuery('caller_id.department');
	ga.groupBy('caller_id.department');
	ga.addAggregate('COUNT');
	ga.query();
 
	//Determine the total number of incidentsvar total =0;while(ga.next())
		total += parseInt(ga.getAggregate('COUNT'));	
	ga.setLocation(-1);
 
	var dmtable_cmn_department = methodUtils.getDimensionTableFromTransactionTable('cmn_department');//Create methods weighted on number of callers per departmentwhile(ga.next()){var cmn_department = ga.getValue('caller_id.department');var dm_cmn_department = methodUtils.getDimension(dmtable_cmn_department, cmn_department);var count = ga.getAggregate('COUNT');var percentage =(count *100)/ total;
 
		if(dm_cmn_department){
			itcoa_segments ={
				segment2 : dm_cmn_department
			};
			methods.push(methodUtils.createPercentageMethod(itcoa_segments, dmtable_cmn_department, percentage));}}
 
	return methods;
}

Allocate by number of servers

This weighted allocation metric allocates to servers based on the server cost.
  • Metric name: Servers by Server cost
  • Type: weighted
Notice the following field values:
  • Weight table is the Server table in the CMDB.
  • Reference to allocate to is the field on the weight table that you are allocating to. In this case, you are allocating to individual servers that are identified by their sys_id.
  • Aggregate takes the value of the Aggregate count field in the weight table, which in this case is Cost.
  • Aggregate count is the cost of each server, which is identified on the server record.
Figure 1. A metric that weights allocations by server cost
A metric that weights allocations by server cost