Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello, I've got an issue with filtering on selected values.
In a simplistic dataset (below):
BreedSpeciesLife expectancyPredominant colour
| Labrador | Dog | 10 | White |
| German Sherphard | Dog | 12 | Brown |
| Pekingese | Dog | 15 | White |
| Border Collie | Dog | 11 | Black |
| Scottish Fold | Cat | 16 | Orange |
| Turkish Angora | Cat | 17 | White |
| Siamese | Cat | 15 | Beige |
| Maincoon | Cat | 18 | Brown |
| Parrot | Bird | 90 | Orange |
| Pigeon | Bird | 4 | Grey |
| Weaver | Bird | 2 | Yellow |
| Eagle | Bird | 17 | Grey |
I am trying to have a measure that works with a slicer to show me the average age of a species. The goal is to be able to compare various other attributes to that average. I've created a measure that looks like this:
Solved! Go to Solution.
Hi @KabirDhupelia ,
When you use the SELECTEDVALUE it only returns a single value so when you select more than one you get the blank. Try the following measure:
Species life expentancy =
var Years_ = CALCULATE(SUM('Life expectancies'[Life expectancy]),ALLSELECTED('Life expectancies'[Species])
var NumBreeds_ = CALCULATE(DISTINCTCOUNT('Life expectancies'[Breed]),ALLSELECTED('Life expectancies'[Species])
Return DIVIDE(Years_,NumBreeds_)
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @KabirDhupelia ,
When you use the SELECTEDVALUE it only returns a single value so when you select more than one you get the blank. Try the following measure:
Species life expentancy =
var Years_ = CALCULATE(SUM('Life expectancies'[Life expectancy]),ALLSELECTED('Life expectancies'[Species])
var NumBreeds_ = CALCULATE(DISTINCTCOUNT('Life expectancies'[Breed]),ALLSELECTED('Life expectancies'[Species])
Return DIVIDE(Years_,NumBreeds_)
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThanks! Works like a charm, going to move this over to the mega dataset but I can't see why it wouldn't work if it worked on the dummy set. Thanks again
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!