Forum Discussion
AlexW24
11 months agoNew Member
Distinct with multiselect slicer
How can I update the following to allow multiple selected values in a slicer? Distinct Apps =
CALCULATE(
DISTINCTCOUNT(AppUsage[AppName]),
FILTER(
AppUsage,
AppUsage[U...
- 11 months ago
Hi ,
You’re running into a classic SELECTEDVALUE limitation: it only returns a single value. With multiple developers selected, SELECTEDVALUE goes blank, so your filter logic no longer excludes the chosen names.Use the IN operator against the selected list, and guard for the “no selection” case so you don’t exclude everyone by accident:
Distinct Apps =
VAR HasDevFilter =
ISFILTERED(DeveloperTable[UserName])
VAR SelectedDevs =
VALUES(DeveloperTable[UserName]) -- all developers currently selected in the slicer
RETURN
IF (
NOT HasDevFilter, -- nothing selected: show all apps (no exclusions)
DISTINCTCOUNT ( AppUsage[AppName] ),
CALCULATE (
DISTINCTCOUNT ( AppUsage[AppName] ),
REMOVEFILTERS ( DeveloperTable[UserName] ), -- ignore slicer’s direct filter first
NOT ( AppUsage[UserName] IN SelectedDevs ) -- then exclude selected developers
)
)If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.
v-saisrao-msft
Community Support
11 months agoHi AlexW24,
Thank you tayloramy, for your insights.
I've reproduced the issue and received the following output. I've also attached the pbix file for your reference.
Hope this helps
Thank you.