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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
zahidah_mabd
Helper I
Helper I

Using NOT and IN function

Hi, I want to filter values which is not in the list provided.

Here is my measure but it filters the valua that I want to exclude.

Sum Incorrect Technical Professional SG = 

CALCULATE( COUNTROWS('zhpla'),

FILTER(

'zhpla',

'zhpla'[Position Category] = "Technical Professional (TP)" &&

'zhpla'[Employee Assignment Category]

IN {"Permanent ~ Executive","Permanent ~ Management" } &&

NOT ('zhpla'[Employee Assignment Category] IN {"P1", "P2", "P3", "P4", "P5", "P6", "P7", "P8", "P9", "P10", "P11", "P12", "P13", "P14" })

)

)+0

can you help me?

2 REPLIES 2
jdbuchanan71
Super User
Super User

In my test the result is what I would expect.  You can simplify the measure some, first the NOT IN does not need to be there because this line already limits it to just 2 categories.  The {P1..P14} are already excluded.

'zhpla'[Employee Assignment Category] IN { "Permanent ~ Executive", "Permanent ~ Management" }

You can also just count the filter so it ends up like this.

Sum Incorrect Technical Professional SG = 
COUNTROWS(
    FILTER (
        'zhpla',
        'zhpla'[Position Category] = "Technical Professional (TP)" &&
		'zhpla'[Employee Assignment Category] IN { "Permanent ~ Executive", "Permanent ~ Management" }
    )
) + 0

Now, if you are saying that the lines still show up in a table with this measure in it, that is because of the +0 forcing the measure to return a result.  So if you want to get rid of that behaviour, remove the +0

2022-06-25_23-34-46.jpg

danextian
Super User
Super User

Hi @zahidah_mabd,
Please note of the position of "(".  I have placed it before NOT.

Sum Incorrect Technical Professional SG =
CALCULATE (
    COUNTROWS ( 'zhpla' ),
    FILTER (
        'zhpla',
        'zhpla'[Position Category] = "Technical Professional (TP)"
            && 'zhpla'[Employee Assignment Category]
            IN { "Permanent ~ Executive", "Permanent ~ Management" }
            && ( NOT 'zhpla'[Employee Assignment Category]
            IN {
            "P1",
            "P2",
            "P3",
            "P4",
            "P5",
            "P6",
            "P7",
            "P8",
            "P9",
            "P10",
            "P11",
            "P12",
            "P13",
            "P14"
        } )
    )
) + 0

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.