Formula to check if all data in a single column have the same value

I m looking for a formula in knime on how to get a result by checking if all data in a single column have the same value

Hi @Kia31

I don’t know a formula to check if all data in a single column have the same value. But I know there is node, the: Constant Value Column Filter node.

gr. Hans

1 Like

Hello @Kia31 , and welcome to the KNIME community.

You can use ‘Rank’ with Ranking Mode == Dense, targeting your $column_item$.

Then ‘GroupBy’ Manual Aggregation == $Sum(rank)$

IF ‘Sum(rank)’ value MATCHES ‘Number Rows’ from ‘Extract Table Dimension’ THEN all your values have same value.

BONUS: It works for both, String and Numeric column types.

BR

1 Like

Some other possibilities…

  • Use Duplicate Row Filter on the column (removing duplicates) followed by Extract Table Dimensions, and if the “Number Rows” flow variable is 1, then they are all the same

  • GroupBy “unique count”, and tick whether you wish to include or exclude missing values. Then a Table Row to Variable node will create you a unique count variable that you can test for “=1”

2 Likes