Pergunta

I have a measure in my PowerPivot table that returns 1 or 0 conditional on the values of other measures in the same row.

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. 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.

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top