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
Travelling_Kath
New Member

Reverse filter for multiple selections

I'm doing analysis on Microsoft 365 licenses assigned to accounts in Entra ID. As some organisations have a requirement for certain license assignments per account, for example O365 E3 and EMS E3, I'm wanting to get a list of accounts that don't have the selected licenses assigned to them.

I've created an unrelated table with the list of licenses which I've added as a slicer, however I've tried a couple of formulas but they only give me a list of accounts with either of the selected licenses assigned.

Sample data for users table:

License AssignedUser principal name
Microsoft Power Automate Freeoliver@abccorp.com.au
Microsoft 365 E5oliver@abccorp.com.au
Microsoft Power Automate Freesylvia@abccorp.com.au
Power BI Prosylvia@abccorp.com.au
Office 365 E3sylvia@abccorp.com.au
Office 365 E3andrew@abccorp.com.au
Microsoft Power Automate Freekaren@abccorp.com.au
Power BI Prokaren@abccorp.com.au
Microsoft 365 Audio Conferencingkaren@abccorp.com.au
Microsoft 365 E3karen@abccorp.com.au
Office 365 E3joel@abccorp.com.au
Microsoft Power Automate Freekylie@abccorp.com.au
Microsoft 365 E5kylie@abccorp.com.au
Enterprise Mobility + Security E3kath@abccorp.com.au
Power BI Prokath@abccorp.com.au
Office 365 E3kath@abccorp.com.au
Microsoft Power Automate Freekath@abccorp.com.au
Microsoft Power Automate Freefred@abccorp.com.au
Microsoft 365 E3fred@abccorp.com.au

 

Licenses table list:

License Assigned
Microsoft Power Automate Free
Microsoft 365 E5
Power BI Pro
Microsoft 365 E3
Office 365 E3
Microsoft 365 Audio Conferencing
Enterprise Mobility + Security E3

 

Travelling_Kath_0-1720595026377.png

 

I found some code for reverse filters, however it doesn't give me what I need:

 

 

ShowNonCompliant = 
if(max('users'[License Assigned]) in ALLSELECTED('Licenses'[License Assigned]) && COUNTROWS(ALLSELECTED('Licenses'[License Assigned])) <> countrows(all('Licenses'[License Assigned])), "y", "n")

 

 

It only gives me accounts with either of the licenses assigned, where I'd like to know which accounts don't have them both assigned (for example Andrew, Joel and Sylvia).

Travelling_Kath_2-1720595566696.png

Hoping someone can help!

 

5 REPLIES 5
v-tianyich-msft
Community Support
Community Support

Hi @Travelling_Kath ,

 

I made a simple sample, you can check the results as follows:

vtianyichmsft_0-1720675285218.png

Selected = 
CONCATENATEX(
    VALUES('Table 2'[Desc]),
    'Table 2'[Desc],
    ","
)
 
Matched = 
VAR Selected = [Selected]
VAR DescList =
CALCULATETABLE(
    VALUES('Table'[Desc]),
    ALLEXCEPT('Table', 'Table'[ID])
)
RETURN
IF(
    CONTAINSSTRING(
        Selected,
        CONCATENATEX(DescList, 'Table'[Desc], ",")
    ),
    1,
    0
)

 

An attachment for your reference. Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

Thanks, Scott @v-tianyich-msft . It's working, but only if the user (ID) has only 2 licenses (Desc). It doesn't seem to work if they only have 1 license, or have 3 or more licenses.

From your example, if ID 1 had D as well as A and C, or if ID 4 only had A.

Is there an easy way of accommodating for this scenario?

Thanks, Kath.

Hi @Travelling_Kath ,

 

I'm sorry to say that it doesn't seem to work in my experience. Because there is no such concept as full equality in DAX, either the IN operator or CONTAINSSTRINGEXACT, they both mean containment not full equality.

 

Best regards,
Community Support Team_ Scott Chang

Joe_Barry
Super User
Super User

Hi @Travelling_Kath 

 

Create a one to many relationship between the Licences table and teh USer table on the Licence column.

Add the Column from the Licence Table to a table visual then the User Principal Name too. On the right side of the screen go to the Build Table and right click on one of the column names and choose the option "Show items with no data"

 

Hope this helps

Joe




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Learn about the Star Schema, it will solve many issues in Power BI!

Date tables help! Learn more



LinkedIn
Let's connect on LinkedIn


Thanks for your response, @Joe_Barry . Unfortunately it gives me all users with any of the licenses selected, rather than those with only the selected licenses.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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