按相同ID分组的Power BI Sum单元格 [英] Power BI Sum cells grouped by same ID

查看:275
本文介绍了按相同ID分组的Power BI Sum单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何制作一个公式,对所有具有相同ID的单元格求和?

How can I make a formula which sums all the cells which have the same ID?


编辑:这两个列都在同一张表中。我需要一个新列来计算具有相同ID的所有小时的总和。

Both of these columns are in the same table. I need a new column which calculates the sum of all the hours with the same ID.

推荐答案

在这种情况下,我将创建一个新的夏季表:

In that case, I would create a new summery table:

SummeryTable = 
SUMMARIZE(
    'TableName';
    'TableName'[ID];
    "Time_summed"; SUM('TableName'[TimeColumn])
)

然后,您将得到一个表,该表的每行上都有不同的[ID],并且原始数据表中与该ID相对应的所有小时数的总和。您可以用来与原始表建立关系。

Then you will end up with a table with distinct [ID] on each row and the sum of all hours corresponding to this ID from the original data table. Which you can use to create a relationship with the original table.

EDIT_1:

是的,如果您使用这样的计算列,则可以:

Yes you can if you use a calculated column like this:

SumTime = 
VAR thisID = [ID]
RETURN
CALCULATE(
    SUM('TableName'[TimeColumn]);
    ALL('Tablename');
    'TableName'[ID] = thisID
)

这篇关于按相同ID分组的Power BI Sum单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆