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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Filter NOT and Include.

hi,

in Cognos i have a filter that looks like this:

Fact_PO NOT([PO Type] includes ("INT", "IN2") AND [Status] includes ('10','15','31')

In PBI webversion it is apparently not possible to make such filter without using a DAX statement.

So, i have tried:

IF(

COUNTROWS(

FILTER(

FACT PO,

FACT PO[PO TYPE]<> "INT" &&

FACT PO[PO TYPE]<> "IN2" &&

(FACT PO[STATUS]=10 || FACT PO[STATUS]=15 || FACT PO[STATUS]=31)

)

) >0,

1,

0

)

 

but it is giving issues while executing...

Anyone an idea to solve this??

thanks!!

M

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Anonymous 

please try

Measure =
INT (
ISEMPTY (
FILTER (
'Fact PO',
NOT ( 'Fact PO'[PO Type]
IN { "INT", "IN2" }
&& 'Fact PO'[Status] IN { "10", "15", "31" } )
)
)
)

View solution in original post

6 REPLIES 6
tamerj1
Super User
Super User

Hi @Anonymous 

please try

Measure =
INT (
ISEMPTY (
FILTER (
'Fact PO',
NOT ( 'Fact PO'[PO Type]
IN { "INT", "IN2" }
&& 'Fact PO'[Status] IN { "10", "15", "31" } )
)
)
)

Anonymous
Not applicable

hi Tamerj1

thanks for helping out, it seems to be working!!!!

well done.

Mrt

CNENFRNL
Community Champion
Community Champion

Syntax equivalent

Flag = 
1 - CALCULATE(
        ISEMPTY( Fact_PO ),
        NOT ( Fact_PO[PO Type] IN { "INT", "IN2" } && Fact_PO[Status] IN { 10, 15, 31 } )
    )

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Anonymous
Not applicable

HI,

thanks for the swift response, appreciate it.

unfortunately the proposed statement genereates an error: 

syntax or sematic error at line.... Function CONTAINSROW does not support comparing values of type integer with values of type text. Consider using the VALUE or FORMAT function to convert one of the values.

 

FreemanZ
Super User
Super User

hi @Anonymous 

try like:

IF(
    COUNTROWS(
        FILTER(
           FACT PO,
           AND(
              NOT FACT PO[PO TYPE] IN{"INT", "IN2"},
              FACT PO[STATUS] IN {10, 15, 31}
            )
        )>0, 1, 0
)
Anonymous
Not applicable

HI Freeman,

thanks for your swift response, appreciate it!

Unfortunately i get an error messag: syntax or semantic error: at line.... Too many arguments were passed by the COUNTROWS Function. The maximum argument count for the function is 1.

Any alternatives?

thanks!!

M

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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