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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
emveha
Resolver III
Resolver III

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 @emveha 

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 @emveha 

please try

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

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!

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 @emveha 

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
)

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors