No need to count "0" value in groupby node

Hi there,
I dont want to count “0” in group by node, i tried missing checkbox, but it didnt work. Can you help me?

Hi @Aysedogan,

Why don’t you filter them before the GroupBy node?

As summary , i will explain visually

x y
row1 2 0
row2 3 4
row3 5 8
row4 6 0
i need to see the aggreation in one group by issue count(y)
count(x)

You could use a Rule Engine to replace the "0" by a missing value. Apply this rule and replace Column y:

NOT $y$ = 0 => $y$

Then you can use a GroupBy normally.

2 Likes

Just to be clear you want a count not a sum? So x should be 4 and y 2 in your example? Then both proposed solutions work and if the rows can be safely excluded (not needed for other aggregations) then the Row filter seems simpler and more elegant.

thank you so much, it works :slight_smile:

1 Like

yes , it is excatly that i want, i could manage to do it with the previous solution :slight_smile:

Hi again,

I am new in Knime, that’s why i have a lot of question :slight_smile:

For example, i have a list like that

row1 x
row2 x,y,z
row3 x
row4 y,z,x,k
row5 x

ı need to exclude row3,row1,row, that’s means those containig ‘x’ alone. Which pattern shall i use in rule based row filter?

I tend to use the “Rule Based Splitter Node” for these things.

$x$ = “x” => FALSE
TRUE => TRUE

You can route the TRUE to either output with a toggle at the bottom, so you can also reverse the formula and switch the toggle to get the same result.

$x$ = “x” => TRUE
TRUE => FALSE
(selecting toggle pointing TRUE to the second output)

The way I like to read the Rule based syntax is to read the “=>” as “yields”, and the TRUE that starts the last line of the syntax as more of a final “else” for rows that failed all of the above tests.

TRUE and FLASE results are both case sensitive, and they can be used to generate boolean values in general in the Rule node as well.

thank you :slight_smile:

1 Like

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