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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Employee
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
Employee
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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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