Filtering the rows by rules

Hi everyone,

I would like to filter the rows as the rules below:

-If “code” column is starting with “S1”, “stock” column is “0” and “order quantity” is greater than “0”, bring all the “Group” rows of that group.
-If not, eliminate all the codes of that group.


For example in the 3rd row, “code” is starting with “S1”, “stock” is “0” and “order quantity” is greater than “0”. In this case I want to bring all the rows of “A” group and I want to eliminate the B and C group rows.

I want it to be like the table below;


Thanks !

You can use



Hello izaychik63,

Thanks for your reply. I have tried the rule-based row filter but I want to filter these table on group based. For example even if the second row doesnt meet the rules I mentioned, this row should’nt be eliminated as they are in the same “group” (A group) with the third row.

Hi @ellobyhn , one approach is to create a rule based row filter that finds all rows that match your rule.

So this finds the rows containing Code beginning S1, Stock=0, Order Quantity > 0

You can then join this back to your original data set on “Group” and that will bring through all rows for the required group and no others

Here I’ve also used a groupby on “Group” as a shortcut for ensuring I don’t have multiple rows containing the same “Group” coming though.

These “required groups” can then be joined back onto the original data, by “group” so it brings through all required rows, but none of the others

There are other ways that this could be achieved but hopefully this gives you an idea to work with.

filter using rule and join.knwf (11.1 KB)


Hello takbb,

It works! Thanks! :slight_smile:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.