简体   繁体   English

'sumif' 或计算/求和同一列 power BI 中的值

[英]'sumif' or calculate/sum for values in the same column power BI

I've got a sum within a spreadsheet which I need to create within a powerBI table but I am completely stumped at the moment as to how I might create it as I am quite new to the program.我在一个电子表格中有一个总和,我需要在 powerBI 表中创建它,但我现在完全不知道如何创建它,因为我对这个程序很陌生。

the sum within excel is as follows SUMIFS($X:$X,$J:$J,"Y",$AS:$AS,$AO47) excel 内的总和如下SUMIFS($X:$X,$J:$J,"Y",$AS:$AS,$AO47)

this seems simple enough however the sum range X:X is the same as the column X with the formula the values in columns AS & AO mean that it doesn't create a circular reference.这看起来很简单,但是总和范围 X:X 与 X 列相同,公式为 AS 和 AO 列中的值意味着它不会创建循环引用。

in power BI the column names translate as follows:在 power BI 中,列名转换如下:

X = Spli

J = BLD

AS = NotID

AO = CRef

as far as I can see it's just not an option to use calculate/Sum and refer to the same column... I'm unsure if there would be a workaround for this that I'm just not seeing.据我所见,使用计算/总和并引用同一列不是一个选项...我不确定是否会有解决方法,而我只是没有看到。

Hopefully someone can help: :)希望有人可以提供帮助::)

If I get your issue correct, you can use either CALCULATE or SUMX for your Measure as stated below-如果我的问题正确,您可以使用CALCULATESUMX作为您的Measure ,如下所述 -

Using CALCULATE -使用计算-

_sum =
CALCULATE(
    SUM(your_table_name[column_name]),
    FILTER(
        ALL(your_table_name),
        your_table_name[filter_column_name_1] = 1
        && your_table_name[filter_column_name_2] = "ABC"
    )
)

Using SUMX -使用SUMX -

_sum =
SUMX(
    FILTER(
        ALL(your_table_name),
        your_table_name[filter_column_name_1] = 1
        && your_table_name[filter_column_name_2] = "ABC"
    ), 
    your_table_name[column_name]
)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM