Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Stevianne
Frequent Visitor

advanced filtering

Hello Powerbi community,

 

I need some help with advanced filtering. I created a small example. When I filter on Bananas I do not only want to see 

A, B and D I also want to see A bought 5 peaches just like B bought 4 peaches. When filtering on Apples I want to see C bought 4 buth also bought 2 peaches.

So when filtering on a certain fruit I also want to see the other fruits that might be bought by A B C or D.

 

        Bananas    Apples     Peaches

A         4              0               5     

B         3              0               4

C         0              4               2

D         2              0              0

 

Which advanced filtering is needed to achieve this? thanks for your help!

 

1 ACCEPTED SOLUTION

Hi @Stevianne ,

Extract the fruit column as a single calculated table and use it as a the slicer:

Fruit = DISTINCT('Table'[Fruit])

Create a measure like this:

_count = 
VAR tab =
    FILTER (
        'Table',
        CALCULATE (
            SUM ( 'Table'[Count] ),
            FILTER (
                ALLEXCEPT ( 'Table', 'Table'[Category] ),
                'Table'[Fruit] = SELECTEDVALUE ( Fruit[Fruit] )
            )
        ) > 0
    )
RETURN
    SUMX (
        FILTER (
            tab,
            [Category]
                IN DISTINCT ( 'Table'[Category] )
                    && [Fruit] IN DISTINCT ( 'Table'[Fruit] )
        ),
        [Count]
    )

r1.pngr2.png

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Stevianne , first of all, these fruits need to be in rows. means you need you have un pivoted dhttps://radacad.com/pivot-and-unpivot-with-power-bi

 

You need independent fruit table

fruit = distinct(Table[fruit])

 

Then a measure like 

measure  =

var _user = summarize(filter(Table, Table[Fruit] in allselected(Fruit[Fruit])), Table[User])

return

calculate(sum(Table[Qty]), filter(Table, Table[User] in _user)) 

 

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi,

 

Thanks for your feedback. I tried your option. I'am I right you create

 

- table for fruit (apples, bananas, peaches)

- table for user (A,B,C and D)

- table with quantity? (how to creatie this one?)

 

 

for me it would be helpfull if you are able to make an example in PBI, is that possible?

 

thanks a lot so far!

 

Hi @Stevianne ,

Extract the fruit column as a single calculated table and use it as a the slicer:

Fruit = DISTINCT('Table'[Fruit])

Create a measure like this:

_count = 
VAR tab =
    FILTER (
        'Table',
        CALCULATE (
            SUM ( 'Table'[Count] ),
            FILTER (
                ALLEXCEPT ( 'Table', 'Table'[Category] ),
                'Table'[Fruit] = SELECTEDVALUE ( Fruit[Fruit] )
            )
        ) > 0
    )
RETURN
    SUMX (
        FILTER (
            tab,
            [Category]
                IN DISTINCT ( 'Table'[Category] )
                    && [Fruit] IN DISTINCT ( 'Table'[Fruit] )
        ),
        [Count]
    )

r1.pngr2.png

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

 

I apllied the measure you created. Thanks it was very helpfull. Next step I want to make is to apply this measure "_count" in a table.  I want to measure the % of the total.

 

total_sum__count = Sum(_count)   (I can't create this measure)

%total =  _count divide total_sum__count

 

Do you have any ideas how to solve this?

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.