Is it possible to create Excel function TRIMMEAN in knime?

@gabrielfs2

Modified workflow attached:
Trimmean3.knwf (48.6 KB)

Changes:

  1. You need to select have the grouping variable in the include box. The categories from this column will determine the grouping of the rows. Note that I have also selected Enforce Inclusion. It is worth understanding into which category (Exclude or Include) KNIME adds new columns if they are added to your workflow. If you select Enforce Inclusion then any new columns are added to the Exclude list. If you Enforce exclusion, then new columns are added to the include list. If, when you are creating bigger workflows you do not want to add new grouping categories then you will need to select Enforce inclusion to ensure that they are always excluded. Many is the time that adding additional columns (by design, or accident) has caused problems when those columns are added in the wrong category.

  1. TRIMMEAN node I put SALE under the include category and COD under the exclude. I am assuming you want to TRIMMEAN the SALE. It might be counter-intuitive, but the node selects values from the columns on the right, not the left.

Screenshot_20230115_230009

  1. I set the Constant Value Column to append a new column (COD) and set the value of that column to the variable GroupIdentifier (if you push the V button to the left of the line that starts with the Value settings dialogue you will get a modal dialogue with a drop down to select the variable. The warning at the bottom shows that the value is set by a variable.

  2. I also added a string manipulation (Variable) node because KNIME (rather unhelpfully) encloses the group name (GoupIdentifer) variable in percentage symbols (grrrr!).

  3. Loop End. What you had was fine. I have a preference for Generating new row IDs and unchecking the Add iteration column option so changed those options.

  4. I also changed the data type of the COD column from Double to Integer (formats nicer without the decimals), you could also change it to string (depends upon the nature of your codes). To change the type of the column open the table, double-click on the column heading. A modal dialogue box will open and you can select the data type of your column.

Hope that helps

DiaAzul
LinkedIn | Medium | GitHub

4 Likes