Forum Discussion
weilai0521
7 years agoFrequent Visitor
Exclude missing values with calculate
Hi, I have a formula like this to calculate percentages which can be changing dynamically with age, gender filters. But there are some 'DATA'[XXX] with missing values "." and I want to exclude th...
- 7 years ago
add the
DATA[XXX]<>"."
to your denominator calculate, like this:
DIVIDE ( CALCULATE ( SUM ( 'DATA'[Weight] ), FILTER ( 'DATA', 'DATA'[XXX] = "Yes" && 'DATA'[Age] = [Selected_Age] && 'DATA'[Gender] = [Selected_Gender] ) ), CALCULATE ( SUM ( 'DATA'[Weight] ), ALLEXCEPT ( 'DATA', 'DATA'[Year], 'DATA'[Age], 'DATA'[Gender] ), DATA[XXX] <> "." ) ) - 7 years ago
Thank you! This is very helpful!
Stachu
7 years agoCommunity Champion
add the
DATA[XXX]<>"."
to your denominator calculate, like this:
DIVIDE (
CALCULATE (
SUM ( 'DATA'[Weight] ),
FILTER (
'DATA',
'DATA'[XXX] = "Yes"
&& 'DATA'[Age] = [Selected_Age]
&& 'DATA'[Gender] = [Selected_Gender]
)
),
CALCULATE (
SUM ( 'DATA'[Weight] ),
ALLEXCEPT ( 'DATA', 'DATA'[Year], 'DATA'[Age], 'DATA'[Gender] ),
DATA[XXX] <> "."
)
)weilai0521
7 years agoFrequent Visitor
Thank you! This is very helpful!