写点什么

小智常见报表示例 -- 层次坐标 -- 交叉表累计报表

作者:小智数据
  • 2024-07-17
    河北
  • 本文字数:1890 字

    阅读完需:约 6 分钟

小智常见报表示例--层次坐标--交叉表累计报表

概述

交叉表累计:按照从左到右对数据进行横向累加。

应用场景

如下图所示,统计不同商品各季度销售额的累计销售额


实现思路

通过下列公式实现交叉表累计计算=B2+C2[;B1:-1]

示例说明

数据准备

在数据面板中添加数据集,可选择 Json 数据集和 Http 接口数据集,Json 数据如下图所示:


[{"商品":"A产品","季度":1,"销售额":5890.56},{"商品":"A产品","季度":2,"销售额":4566.26},{"商品":"A产品","季度":3,"销售额":7861.56},{"商品":"A产品","季度":4,"销售额":5654.56},{"商品":"A产品","季度":1,"销售额":5820.96},{"商品":"A产品","季度":2,"销售额":5666.26},{"商品":"A产品","季度":3,"销售额":8661.56},{"商品":"A产品","季度":4,"销售额":5254.56},{"商品":"B产品","季度":1,"销售额":5890.56},{"商品":"B产品","季度":2,"销售额":4456.16},{"商品":"B产品","季度":3,"销售额":7561.56},{"商品":"B产品","季度":4,"销售额":3554.56},{"商品":"B产品","季度":1,"销售额":4620.96},{"商品":"B产品","季度":2,"销售额":5456.26},{"商品":"B产品","季度":3,"销售额":8891.56},{"商品":"B产品","季度":4,"销售额":5623},{"商品":"C产品","季度":1,"销售额":4600.78},{"商品":"C产品","季度":2,"销售额":5246},{"商品":"C产品","季度":3,"销售额":7761.56},{"商品":"C产品","季度":4,"销售额":8164},{"商品":"C产品","季度":1,"销售额":4645.56},{"商品":"C产品","季度":2,"销售额":6579},{"商品":"C产品","季度":3,"销售额":7591.56},{"商品":"C产品","季度":4,"销售额":7168},{"商品":"D产品","季度":1,"销售额":4678.56},{"商品":"D产品","季度":2,"销售额":6659},{"商品":"D产品","季度":3,"销售额":7567.56},{"商品":"D产品","季度":4,"销售额":7498},{"商品":"D产品","季度":1,"销售额":5246},{"商品":"D产品","季度":2,"销售额":4645},{"商品":"D产品","季度":3,"销售额":7561.8},{"商品":"D产品","季度":4,"销售额":7941},{"商品":"E产品","季度":1,"销售额":5890.56},{"商品":"E产品","季度":2,"销售额":4566.26},{"商品":"E产品","季度":3,"销售额":7861.56},{"商品":"E产品","季度":4,"销售额":5654.56},{"商品":"E产品","季度":1,"销售额":5820.96},{"商品":"E产品","季度":2,"销售额":5666.26},{"商品":"E产品","季度":3,"销售额":8661.56},{"商品":"E产品","季度":4,"销售额":5254.56},{"商品":"F产品","季度":1,"销售额":5890.56},{"商品":"F产品","季度":2,"销售额":4456.16},{"商品":"F产品","季度":3,"销售额":7561.56},{"商品":"F产品","季度":4,"销售额":3554.56},{"商品":"F产品","季度":1,"销售额":4620.96},{"商品":"F产品","季度":2,"销售额":5456.26},{"商品":"F产品","季度":3,"销售额":8891.56},{"商品":"F产品","季度":4,"销售额":5623},{"商品":"G产品","季度":1,"销售额":4600.78},{"商品":"G产品","季度":2,"销售额":5246},{"商品":"G产品","季度":3,"销售额":7761.56},{"商品":"G产品","季度":4,"销售额":8164},{"商品":"G产品","季度":1,"销售额":4645.56},{"商品":"G产品","季度":2,"销售额":6579},{"商品":"G产品","季度":3,"销售额":7591.56},{"商品":"G产品","季度":4,"销售额":7168},{"商品":"H产品","季度":1,"销售额":4678.56},{"商品":"H产品","季度":2,"销售额":6659},{"商品":"H产品","季度":3,"销售额":7567.56},{"商品":"H产品","季度":4,"销售额":7498},{"商品":"H产品","季度":1,"销售额":5246},{"商品":"H产品","季度":2,"销售额":4645},{"商品":"H产品","季度":3,"销售额":7561.8},{"商品":"H产品","季度":4,"销售额":7941}]
复制代码


报表设计

将数据字段依次对应拖拽到对应单元格中,并将 A2 单元格中表格设置为分组以及向下扩展、B1 与 C1 单元格合并后设置为分组以及向右扩展、B2 单元格中表格设置为分组以及双向扩展,并把填入的单元格框选后添加分组。如下图所示:



交叉表累计的公式说明:=B2+C2[;B1:-1]C2[;B1:-1]:表示上父格 B1横向扩展出来的上一格(上季度)的 C2 的值;B2+C2[;B1:-1]:表示当前季度的销售额加上上一季度累计销售额
复制代码

效果预览

交叉表演示.json


https://www.yuque.com/attachments/yuque/0/2023/json/25420404/1686291216777-10fbf5d6-8e71-46a0-8e07-6ea8018fd598.json
复制代码


参考文档

下一篇 组内占比报表

用户头像

小智数据

关注

小智BI-数据分析 小智报表-类excel报表中心 2024-07-03 加入

小智数据深耕数据工具领域,为企业加速信息流通与智慧决策,赋能数字化转型。开源表格控件、大屏可视化组件、嵌入式报表工具/BI-SaaS平台、SAAS连接器等。

评论

发布
暂无评论
小智常见报表示例--层次坐标--交叉表累计报表_自定义报表打印控件_小智数据_InfoQ写作社区