[英]How to calculate Cumulative Sum in Power BI
I've selected New quick measure -> Totals -> Running total and creates this:我选择了 New quick measure -> Totals -> Running total 并创建了这个:
sales running total in part =
CALCULATE(
SUM('Query1'[sales]);
FILTER(
ALLSELECTED('Query1'[part]);
ISONORAFTER('Query1'[part]; MAX('Query1'[part]); DESC)
)
)
Returns:返回:
You can also create own measure to calculate cumulative sum.您还可以创建自己的度量来计算累积总和。
Select New Measure from the ribbon and write the following expression从功能区中选择 New Measure 并编写以下表达式
Cumm Sales =
VAR Current_Part = MAX(Test[Part])
RETURN
CALCULATE(
SUM(Test[Sales]),
Test[Part]<=Current_Part,
ALL(Test[Part])
)
Output:输出:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.