You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Power BI中计算Posting type为Posted的Net Sales累计求和

输入图片描述

计算Posting type为"Posted"时Net Sales的累计求和

Excel实现步骤

  • 筛选表格中Posting type等于Posted的行
  • 在空白列(如D列)首行数据行输入公式:=SUM($C$2:C2)(假设Net Sales在C列,首行数据为第2行)
  • 下拉填充公式至所有筛选后的行,得到累计求和结果

SQL实现代码

假设数据表名为sales_records,用窗口函数实现按时间顺序的累计求和:

SELECT
    Posting_type,
    Net_Sales,
    SUM(Net_Sales) OVER (ORDER BY sale_date) AS cumulative_net_sales
FROM sales_records
WHERE Posting_type = 'Posted';

替换sale_date为实际用于排序的日期/时间列,确保累计逻辑符合业务时序

内容的提问来源于stack exchange,提问作者darshini

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.13 18:10:26