如何制作一个公式,对所有具有相同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单元格
发布评论