Icon

Data Wrangling _​ Mean Swap by Categories

Data Wrangling _ Mean Swap by Categories

Data Wrangling _ Mean Swap by Categories

Workflow created for the KNIME forum ...

https://forum.knime.com/t/nested-loop-how-to-do-calculation-on-other-records-and-put-results-in-interested-cells/38135

DESCRIPTION:
The challenge is to swap a Mean (simple Average) calculation with all the elemnts withing the same MAIN_CATHEGORY but excluding the elements owning to the same SUB_CATEGORY.

The approach is by using a Recursive Loop controlled by a variable with the number of iterations.


For any comment or bug realted to the workflow, please do not hesitate to leave your comment.

DISCLAIMER:
The sharing of knowledge in KNIME Hub by using these examples and models, have only demonstration purposes in the advantage of the KNIME community.
These are meant to clarify theoretical background of mentioned subjects in caption.
I will not be held responsibility for any damages arising from the use of these models in your investment/valuation related work, without taking formal advise.

Swapping of SUB_CATEGORY Means: Advanced Solution Using Recursive Loop: Rank bySUB_CATEGORYDense, AscendingDataSourceStartLoopCollect only last iteration from first in-portSecond in-port is passed back to the loop startSplittUpper: Rank = 1Lower: Rank <> 1MeanRank <> 1Merge Meanby MAIN_CATEGORYof OTHERS MEANUn-SplittAdjust Rank NumbersResetRow IDResetRow IDSort Data as in Input DataFilter OutRank ColumnMean BySUB_CATEGORYSUB_CATEGORY SCORE (Mean)SUB_CATEGORY OTHER (Mean)Node 45Max Rank ... ... to Variable(cotrol Loop Iterations) Rank Table Creator RecursiveLoop Start Recursive Loop End Row Splitter GroupBy Joiner Joiner Math Formula RowID RowID Sorter Column Filter GroupBy Column Rename Column Rename Joiner GroupBy Table Rowto Variable Swapping of SUB_CATEGORY Means: Advanced Solution Using Recursive Loop: Rank bySUB_CATEGORYDense, AscendingDataSourceStartLoopCollect only last iteration from first in-portSecond in-port is passed back to the loop startSplittUpper: Rank = 1Lower: Rank <> 1MeanRank <> 1Merge Meanby MAIN_CATEGORYof OTHERS MEANUn-SplittAdjust Rank NumbersResetRow IDResetRow IDSort Data as in Input DataFilter OutRank ColumnMean BySUB_CATEGORYSUB_CATEGORY SCORE (Mean)SUB_CATEGORY OTHER (Mean)Node 45Max Rank ... ... to Variable(cotrol Loop Iterations) Rank Table Creator RecursiveLoop Start Recursive Loop End Row Splitter GroupBy Joiner Joiner Math Formula RowID RowID Sorter Column Filter GroupBy Column Rename Column Rename Joiner GroupBy Table Rowto Variable

Nodes

Extensions

Links