简体   繁体   English

DAX:对C列中的数据求和,并按B列进行过滤,其中关系在A列上

[英]DAX: SUM a data from column C, filtering by column B where relationship is on column A

图片

I need help, 我需要帮助,

I have to data sources in Excel where table A has a UID and table B has that same UID related many to single (many on table B, the single value on table A). 我必须使用Excel中的数据源,其中表A具有一个UID,而表B具有与单个相关的许多相同的UID(表B上有许多,表A上有单个值)。

I want to add all the numerical data in column C on file B but only when column B value is "yes" and show that on table A based on the UID relationship between tables. 我想将所有数字数据添加到文件B的C列中,但仅当B列的值是“ yes”时才显示,并基于表之间的UID关系在表A上显示它。

You should be able to do this with a SUMX in a calculated column: 您应该能够在计算列中使用SUMX来执行此操作:

YesSumC = SUMX(TableB,
               IF(TableB[Column B] = "yes" &&
                  TableB[UID] = TableA[UID],
                  TableB[Column C], 0))

Instead of explicitly matching on UID you could also use RELATEDTABLE like this: 除了在UID上进行显式匹配之外,您还可以使用RELATEDTABLE如下所示:

YesSumC = SUMX(RELATEDTABLE(TableB),
               IF(TableB[Column B] = "yes",
                  TableB[Column C], 0))

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

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