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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Filter Function with "Not Contains"

Hi All,
Any help would be appreciated
I already have a formula in place , I just want to add third condition to this:
First Condition : - if status =1
Second Condition : - Total time for same A values > 5 min
Third condition is(this is needed)  : - for same values of A column, values of column C does not contain string ACL or BCL  string in it

SelectColumns(

Filter(Table1, status=1 &&  Total Time>5 min && "third condition here" ),
"A", A,
"B", B,
"C", C,
'Status", Status,
"Duration", Duration)

 

Sample Data:

MonaliC_0-1739798375618.png

Result Table:

MonaliC_1-1739798400551.png



 

 

 

 

10 REPLIES 10
Anonymous
Not applicable

Hi @ahmedoye ,

 

You should first add column in power query like below, and then modify your formula like below:

vkongfanfmsft_0-1739862698996.png

FilteredTable = 
SELECTCOLUMNS(
    FILTER(
        Table1,
        [status] = 1 &&  
        [First Characters] > 5 && 
        NOT(
            CONTAINSSTRING([C], "ACL") || 
            CONTAINSSTRING([C], "BCL") 
        )
    ),
    "A", [A],
    "B", [B],
    "C", [C],
    "Status", [status],
    "Duration", [Time]
)

vkongfanfmsft_1-1739862832707.png

 

Best Regards,
Adamk Kong

 

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

Anonymous
Not applicable

Hi @Anonymous thanks for replying. Please see my result table. all rows where colum A = 1001, NONE of column C values contain "ACL" or "BCL". Therefore, all of A= 1001 is included. But for A = 1002, there is at least ONE value in C that contains "ACL". Therefore, all of rows where A = 1002 are excluded.
I need a condition where it considers above scenario.

ahmedoye
Responsive Resident
Responsive Resident

Hi, you can modify the Filter side of your formula as below:

Filter(Table1, status=1 &&  Total Time>5 min &&

(FIND("ACL", Table1[C], 1, 0) = 0 || FIND("BCL", Table1[C], 1, 0) = 0))

If this works for you, kindly mark as solution to make it easier for anyone with similar challenges find the solution.

 

Anonymous
Not applicable

@ahmedoye thanks for replying but I think we need to add one more condition to it saying for same "A" value 


ToddChitt
Super User
Super User

Yoiu will want to investigate the CONTAINSSTRING DAX function:

CONTAINSSTRING function (DAX) - DAX | Microsoft Learn

And wrap it in a NOT (  ) funciton:

Filter(Table1, status=1 &&  Total Time>5 min && NOT ( CONTAINSSTRING ( [C] "ACL" ) ),

(Not 100% sure of the above. Do your own researsh and testing, please.)

Hope this helps

 




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





Anonymous
Not applicable

Thanks @ToddChitt I tried this one already but I want the condition which says for any C values of Same "A" column value that does not contain "ACL" or "BCL"

MonaliC_0-1739799921634.png

 

so here I should probably use Allexcept but that's not working. 

Sorry, I don't quite understand the comparison logic. Can you explain in plain language the relationship between A and C and what would, or would NOT, make a row acceptable or unacceptable.




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





Anonymous
Not applicable

So A here is ID - 

for same 1002 we have different C column Values, the idea here is if any of the C column for same value of A column has ACL or BCL it should not be in the result.

So if I understand correctly, all rows where colum A = 1001, NONE of column C values contain "ACL" or "BCL". Therefore, all of A= 1001 is included. But for A = 1002, there is at least ONE value in C that contains "ACL". Therefore, all of rows where A = 1002 are excluded.

Did I state that correctly?




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





Anonymous
Not applicable

Yes you are correct.
Apologies if I couldn't explain better before.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.