Forum Discussion
Create measure excluding current selection
- Anonymous5 years ago
Hello @Banistas
Something along these lines using the EXCEPT function should work, assuming you have a [Number of Pets] measure:
Number of Pets Excluding You = CALCULATE ( [Number of Pets], EXCEPT ( ALL ( YourTable[Persons] ), VALUES ( YourTable[Persons] ) ) )Using ALL ( YourTable[Persons] ) ensures that you always get the total of all people other than filtered people. You can consider ALLSELECTED if there is an external filter on the people you want to use instead of everyone in the dataset.
Best regards
Owen
Hello @Banistas
Something along these lines using the EXCEPT function should work, assuming you have a [Number of Pets] measure:
Number of Pets Excluding You =
CALCULATE (
[Number of Pets],
EXCEPT ( ALL ( YourTable[Persons] ), VALUES ( YourTable[Persons] ) )
)Using ALL ( YourTable[Persons] ) ensures that you always get the total of all people other than filtered people. You can consider ALLSELECTED if there is an external filter on the people you want to use instead of everyone in the dataset.
Best regards
Owen
Thanks @OwenAugerFon. This does exactly what I needed, and can be applied for cases where there are calculations other than SUM which is brilliant.