Nested AllSelected with AllExcept

Hello, I have a measure that has an Allexcept to see the average price by category. I want to add an Allselected to it so when I modify filters (In this case for price) the measure changes as well (right now it stays the same when I filter on price). I tried everything and I can’t find the solution. Any ideads?

Please see file attached.

Thank you

Avg_Cat = AVERAGEX(ALLEXCEPT(Houses,Houses[Category],Houses[Type]),[Price_])

Test.pbix (35.0 KB)

See if it helps you

Avg_Cat2 = 
CALCULATE (
    AVERAGE ( Houses[Price] ),
    ALLSELECTED ( Houses[Price] ),
    REMOVEFILTERS ( Houses[Address] )
)

Hello, @VilmarSchi it’s working. Thank you

However I tried to add a little wrinkle and I can’t seem to figure out the logic of allselected. I added a filter for “Category”. I thought that adding Houses[Category] to Allselected would do the trick, but now the result changes. Any Ideas?

After adding the filter for “Category”, the measurement value remains correct. Should I give another value?

Hello @VilmarSchi , if I add the filter “Category” and select “Parc extension”, the measure doesn’t work anymore if I modify the price.

Instead of keeping 429 625$ for Parc_Ex/3-Plex for all the addresses, it gives a different value for each address. Thank you


Try this one

Avg_Cat2 = 
CALCULATE (
    AVERAGE ( Houses[Price] ),
    REMOVEFILTERS ( Houses[Address] ),
    ALLSELECTED ( Houses[Price],Houses[Category] )
)