简体   繁体   English

如何在同一PowerPivot表中聚合另一个度量?

[英]How to aggregate another measure in the same PowerPivot table?

I have a measure in my PowerPivot table that returns 1 or 0 conditional on the values of other measures in the same row. 我在PowerPivot表中有一个度量,该度量根据同一行中其他度量的值返回1或0。

I would like to write a new measure that returns a "total" of 1 if this measure is 1 for any row in the pivot table. 我想编写一个新的度量,如果对于数据透视表中的任何行 ,此度量均为1,则返回“总计”为1。 More generally, I would like to aggregate over the row values of a different measure. 更笼统地说,我想汇总不同度量的行值。 How can this be done? 如何才能做到这一点?

(Only the total value needs to represent this aggregate, it does not matter what each row evaluates to.) (仅总值需要表示此汇总,每行求值的内容都没有关系。)

Using MAXX(Table_with_row_descriptors, Expression_that_returns_binary_value) almost works, but it changes the evaluation of the Expression_that_returns_binary_value in such a way that for each individual row, the result sometimes differs from that of the simple Expression_that_returns_binary_value measure, so that in some cases, the total is wrong. 使用MAXX(Table_with_row_descriptors,Expression_that_returns_binary_value)几乎可以工作,但是它改变了Expression_that_returns_binary_value的求值,使得对于每一行,结果有时都不同于简单的Expression_that_returns_binary_value度量,因此在某些情况下,总和是错误的。

My colleague found a solution: 我的同事找到了一个解决方案:

IF(HASONEVALUE([row_descriptor]), Expression_that_returns_binary_value, MAXX(values(Table_with_row_descriptors), Expression_that_returns_binary_value)) 

This checks if we are evaluating a normal row in the pivot table, or the "total" row, and uses MAXX only in the latter case. 这将检查我们是在评估数据透视表中的正常行还是“总计”行,并仅在后一种情况下使用MAXX。

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

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