Forum Discussion
RMDNA
9 years agoSolution Sage
Measure: FILTER([value] is not blank
I'm trying to create a measure where I can reference a pre-filtered value. It will end up being a %, but for simplicity: Measure = CALCULATE(DISTINCTCOUNT('TABLE'[Value]),FILTER('TABLE','TABLE'[V...
- 9 years ago
Measure = DIVIDE ( CALCULATE ( DISTINCTCOUNT ( 'TABLE'[Value] ), FILTER ( 'TABLE', 'TABLE'[VALUE] <> BLANK () ) ), DISTINCTCOUNT ( 'TABLE'[VALUE] ), 0 )
Sean
9 years agoCommunity Champion
How about this...
Measure =
CALCULATE (
DISTINCTCOUNT ( 'TABLE'[Value] ),
FILTER ( 'TABLE', 'TABLE'[VALUE] <> BLANK () )
)- RMDNA9 years agoSolution Sage
That gives the correct value. When I try to make it a %, however,
Measure =
CALCULATE (DISTINCTCOUNT ( 'TABLE'[Value] ), FILTER ( 'TABLE', 'TABLE'[VALUE] <> BLANK () ) )/ DISTINCTCOUNT('TABLE'[VALUE])),
(i.e. dividing the filtered value by its unfiltered self), it gives me
"A function FILTER has been used in a True/False expression that is used as a table filter expression. This is not allowed."
- Sean9 years agoCommunity Champion
Measure = DIVIDE ( CALCULATE ( DISTINCTCOUNT ( 'TABLE'[Value] ), FILTER ( 'TABLE', 'TABLE'[VALUE] <> BLANK () ) ), DISTINCTCOUNT ( 'TABLE'[VALUE] ), 0 )- RMDNA9 years agoSolution Sage
That did it. Thanks for making the formatting clear - it was easy to follow the logic.