Forum Discussion
Anonymous
3 years agoNot applicable
Filtering out multiple values for division calculation.
Hello, I would like to do the caluation (Cat) / (Cat + Dog) from a column. But I have two other metrics I don't want to include in the calauation (Mouse & Rabbit), and would would like to filter out...
- 3 years ago
Hi,
I am not sure what visualization you want to present the result, but please try something like,
Pets C/D = DIVIDE ( CALCULATE ( [NoPet], 'Animals'[Pets] IN { "Cat" } ), CALCULATE ( [NoPet], 'Animals'[Pets] IN { "Cat", "Dog" } ) )Or,
Pets C/D = DIVIDE ( CALCULATE ( [NoPet], 'Animals'[Pets] IN { "Cat" } ), CALCULATE ( [NoPet], FILTER ( 'Animals', 'Animals'[Pets] <> "Mouse" && 'Animals'[Pets] <> "Rabbit" ) ) )
Jihwan_Kim
3 years agoSuper User
Hi,
I am not sure what visualization you want to present the result, but please try something like,
Pets C/D =
DIVIDE (
CALCULATE ( [NoPet], 'Animals'[Pets] IN { "Cat" } ),
CALCULATE ( [NoPet], 'Animals'[Pets] IN { "Cat", "Dog" } )
)
Or,
Pets C/D =
DIVIDE (
CALCULATE ( [NoPet], 'Animals'[Pets] IN { "Cat" } ),
CALCULATE (
[NoPet],
FILTER ( 'Animals', 'Animals'[Pets] <> "Mouse" && 'Animals'[Pets] <> "Rabbit" )
)
)
Anonymous
3 years agoNot applicable
Thank you! The top one works perfectly. I'm using it in a line chart to compare the percentage of cats to dogs over time.