Countif Function and Percentage together.

I need support in calculating the % of negative values in a column. I can see the Count Category under the Node: String Manipulation. Though, it counts only Characters not the numbers. Therefore, if anyone can guide me on this query. Thanks.

hi,
how about following solution:
Add a “rule engine” node with and create a column “isnegative” something.
$yourcolumn$ < 0 => 1
TRUE = 0

Then add a “math node” with col_sum(“isnegative”)/rowcount

1 Like

Thanks Andi, this solution is working. Though with this solution I can see the Percentage in each row. Its not showing me the % separately in a single cell. The way we can do it in MS Excel.

Yeah, you can just add a row filter and select the first row only.
As an alternative and in my opinion more elegant solution would be:
add a “group by” node after the rule engine and let calculate the “sum” and “count” of the “isnegative” column. Use a math node to calculate the percentage

1 Like

Another option might be the usage of the node Extract Table Dimension — NodePit This node will give you as one value the row count of a table.

First apply a row filter to get the negative values only. Then get the row count of the original table (your 100%) and the row count of the negative values table.
Using the rowcount you can then calculate the desired value.

2 Likes

Thanks Andi, this option worked well.

image

1 Like

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