# Percentage returning as ?

Hello All,

I’m working on a personal project of mine and I’m running into a small issue.
The data set is 3 point percentage and the values being returned is ?
column a | column b | column c

2 5 40.00%
0 3 0.00%
1 3 33.30%
0 0 ?
1 2 50.00%
2 3 66.70%
0 1 0.00%
0 1 0.00%
2 9 22.20%
0 4 0.00%
0 0 ?
2 2 100.00%

how would I go about ignoring every value other than the ? value. Currently I’m using a rule engine to do this. Hope this makes sense!

@sdthamara welcome to the KNIME forum. Dividing by zero (0) will lead to a missing. It seems this is what is happening.

Rule engine seems fine to select or exclude these lines. You might want to think about what you want to do with the data.

2 Likes

I want to keep these rows but I guess 0/0 is undefined.
What can I place in the rule engine to just replace the “?” with say a n/a?

“N/A” will require it to be a string data type, but you can either do it with the Missing Values node or an additional “if statement” line before your calculation on the rule node using MISSING.

3 Likes

Hi @sdthamara and welcome to the Knime Community.

The issue is definitely about x/0 where column b is 0 as already mentioned by @mlauber71.

How are you generating column c (I mean what node and function are you using)? And what should be the results where you have column b = 0? If you are using the Math Formula node, you can always use the if() function. The usage is:
`if (cond, trueval, falseval)`
So, you could do something like this:
`if(\$column b\$ != 0, \$column a\$/\$column b\$ * 100, 0)`
This will default the result (column c) to 0 if column b is 0, otherwise it will calculate the percentage of column a over column b

But if you are happy with the results, and just want to replace the “?” (empty/missing) by “n/a”, then you can use the Missing Value node. The “?” means it’s an empty value, or a missing value. So the Missing Value node can be used to replace these missing values by whatever you want

4 Likes

Makes sense, I went with iCFO’s suggestion and added a Missing Value Node and that seemed to work.

3 Likes

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