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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Lejouquard
Frequent Visitor

How can I use a filter whose selections are cumulative (AND) and not distinct (OR)?

Hi guys,

In my example I have a table with resources and their language skills (French, English, German, etc).

 

When I select 2 or more languages with a filter I would like to show only the resources who speak the 2 or more selected languages.

 

For example, if I select French & German I just want to show the resources who have the two skills : Danish AND German (in yellow) but not the resources who speak Danish OR German.

 

Capture.PNG

 

How I can do that ?

Thank you for your help!

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

Here is one potential way to do this.  You can make a table visual with just the Employee Name column and this measure.  Employees that don't have all selected languages would return blank and not show in the visual.

 

Speaks All Selected Languages =
VAR __selected =
    COUNTROWS (
        ALLSELECTED ( Table[Language] )
    )
RETURN
    IF (
        DISTINCTCOUNT ( Table[Language] ) = __selected,
        "Y",
        BLANK ()
    )

 

 

Regards,

Pat

 

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
mahoneypat
Microsoft Employee
Microsoft Employee

Here is one potential way to do this.  You can make a table visual with just the Employee Name column and this measure.  Employees that don't have all selected languages would return blank and not show in the visual.

 

Speaks All Selected Languages =
VAR __selected =
    COUNTROWS (
        ALLSELECTED ( Table[Language] )
    )
RETURN
    IF (
        DISTINCTCOUNT ( Table[Language] ) = __selected,
        "Y",
        BLANK ()
    )

 

 

Regards,

Pat

 

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Thx Pat, that's very helpful!

 

Last question :

 

If there is no selection in the filter, I would like to show all the employee name.

 

How i can do that?

Many thanks

Hi @Lejouquard ,

Please try to update the formula of measure which @mahoneypat  wrote as below and check if it can get your expected result:

Speaks All Selected Languages =
VAR __selected =
    COUNTROWS ( ALLSELECTED ( 'Table'[Year] ) )
VAR _allcount =
    CALCULATE ( DISTINCTCOUNT ( 'Table'[Year] ) )
RETURN
    IF (
        DISTINCTCOUNT ( 'Table'[Year] ) = __selected
            || HASONEVALUE ( 'Table'[Year] )
            || __selected = _allcount,
        "Y",
        BLANK ()
    )

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

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

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.