原理
依赖于列表取数(即开篇讲的hcm.model.list、hcm.model.count体系取数)或OpenApi(其他个性化接口或个性化云函数)的取数方式取数、形成一个个数据块(源)、然后将获取的数据整合到excel模版公式上、形成报表进行展示。
由过滤条件、Excel表样、数据块组成
配置大体步骤:
配置步骤
本节以下图所示做一个常规的统计分析表
新建报表
1. 报表平台中点击新增-新建报表
报表类别请选择分析报表、按要求填入必要的基本信息
2. 点击上传模版
将excel表样上传到系统中
点击过滤设置
点击过滤设置、添加报表过滤条件
数据源设置
制作前分析:
此报表规则:选择某个单位,展示这个单位的下一级单位或者部门里面的人员情况。
我们需要至少2个数据源,两个数据源通过组织的origin_id相关联
数据源一:展示某个单位下一级部门。
新建数据源,类型选择自定义,取数选择列表,字段设置origin_id 和名称,基于排序码做排序,是否分页为是,过来条件是日期和部门
元数据参数如下:
关联设置如下:
元数据设置
{
"key": "dept_list",
"data": {
"type": "list",
"field": [{
"key": "origin_id",
"align": "right",
"field": ["origin_id"],
"label": "ORIGIN_ID",
"state": null,
"width": 100,
"format": null,
"object": null,
"is_blur": false,
"sequence": 10,
"data_type": "integer",
"fieldFunc": null
}, {
"key": "name",
"align": "left",
"field": ["name"],
"label": "名称",
"state": null,
"width": 250,
"format": null,
"object": null,
"is_blur": true,
"sequence": 20,
"data_type": "string",
"fieldFunc": null
}]
},
"name": "组织",
"class": "list",
"sorts": [{
"key": "orderno",
"type": "asc",
"label": "排序码"
}],
"source": {
"meta": {
"model": "DepartmentHistory",
"relations": [],
"conditions": {
"enabled": 1,
"end_date": {
"gt": "=date_"
},
"org_type": {
"neq": 40
},
"parent_id": "=depart_id",
"begin_date": {
"lte": "=date_"
}
},
"relation_mode": null,
"static_filters": [{
"key": "date_",
"label": "日期"
}, {
"key": "depart_id",
"label": "上级组织"
}]
},
"type": "meta"
},
"page_count": true,
"filter_dict": {
"date_": "=CURR_DATE",
"depart_id": "=CURR_DEPARTMENT"
},
"total_include": false
}
数据源二:基于此表需要的条件做分组。
元数据设置如下
{
"key": "emp_count",
"data": {
"dim": [{
"dim": {
"field": "dept_level.l1_id"
},
"key": "dept_",
"align": "left",
"field": ["dept_level_l1_id_5", "name"],
"label": "二级部门",
"state": null,
"width": 160,
"format": null,
"object": "OrgDepartment",
"is_blur": false,
"sequence": 10,
"data_type": "integer",
"fieldFunc": null
}, {
"dim": {
"field": "employee_category_id"
},
"key": "category",
"align": "left",
"field": ["master_employee_category_id_b", "name"],
"label": "用工类型",
"state": null,
"width": 160,
"format": null,
"object": "EmployeeCategory",
"is_blur": false,
"sequence": 20,
"data_type": "integer",
"fieldFunc": null
}, {
"dim": {
"field": "position.position_sequence_id"
},
"key": "position_position_sequence_id",
"align": "left",
"field": ["position_position_sequence", "name"],
"label": "序列",
"state": null,
"width": 160,
"format": null,
"object": "JobStepType",
"is_blur": false,
"sequence": 60,
"data_type": "integer",
"fieldFunc": null
}],
"aggr": [{
"key": "count",
"aggr": {
"ag": "count",
"field": "employee_id"
},
"align": "left",
"field": ["master_employee_id_dvli"],
"label": "员工",
"state": null,
"width": 160,
"format": null,
"object": "Employee",
"is_blur": true,
"sequence": 10,
"data_type": "integer",
"fieldFunc": null
}],
"type": "aggr"
},
"name": "全员用工类型",
"class": "list",
"source": {
"meta": {
"model": "JobInformation",
"relations": [{
"key": "employee",
"name": "人员基础信息",
"model": "Employee",
"filter": {
"employee.id": ":employee_id"
}
}, {
"key": "position",
"name": "岗位信息",
"type": "outer",
"model": "OrgPositionHistory",
"filter": {
"position.end_date": {
"gt": "=date_"
},
"position.origin_id": ":position_id",
"position.begin_date": {
"lte": "=date_"
}
}
}, {
"key": "department",
"name": "部门信息",
"type": "outer",
"model": "OrgDepartmentHistory",
"filter": {
"department.end_date": {
"gt": "=date_"
},
"department.origin_id": ":position.parent_id",
"department.begin_date": {
"lte": "=date_"
}
}
}, {
"key": "dept_level",
"name": "组织层级",
"type": "inner",
"model": "DepartmentHierarchy",
"filter": {
"dept_level.l0_id": "=depart_id",
"dept_level.end_date": {
"gt": "=date_"
},
"dept_level.begin_date": {
"lte": "=date_"
},
"dept_level.department_id": ":department.origin_id"
},
"field_context": {
"date_": "=date_",
"root_id": "=depart_id",
"is_relative_level": true
}
}],
"conditions": {
"on_job": 1,
"end_date": {
"gt": "=date_"
},
"begin_date": {
"lte": "=date_"
},
"position_type": 1
},
"static_filters": [{
"key": "date_",
"label": "日期"
}, {
"key": "depart_id",
"label": "上级组织"
}]
},
"type": "meta"
},
"page_count": false,
"filter_dict": {
"date_": "=CURR_DATE",
"depart_id": "=CURR_DEPARTMENT"
},
"total_include": false
}
配置excel公式
此模版用到了两个excel公式、还有很多其他公式我们后面会有详细介绍。
点击计算、完成此报表制作
常见的分析报表公式
VLOOKUP:常用于直接查找。
VLOOKSTAT:查找符合条件的数据后并对数据进行分析,支持分析的方式有汇总类型 count:合计数, sum:汇总数,avg:平均值, max:最大值,min:最小值
VLOOKCUBE:查找的内容后在做组合
CELL:获取指定坐标的值,常用于分析报表里的计算,通过CELL获取部分单元格的值之后相加减。
RANGE_SUM:合计