I’ve been struggling to replicate a result using the Alteryx Multi-Row Formula Tool with grouping enabled. After extensive trial and error, I’ve managed to get about 90% of the records to match. However, there are still some key discrepancies—specifically, cases where the result is 0
instead of empty (or vice versa), or where values are reversed. These inconsistencies are causing errors to cascade into subsequent rows.
Below, I’ve included the logic used in the Alteryx tool, along with the corresponding expression in KNIME (version 5.4.4). I’ve also attached a workflow that includes a sample of the source data, the resulting field from Alteryx (End Inv
), and a join that compares the results side by side.
To emulate the configuration options in Alteryx, I’ve added extra steps for sorting and used a Group Loop in KNIME. However, I’m not confident that I’ve implemented this correctly—or if there might be a simpler or more robust approach, possibly using an existing KNIME component that someone has already developed.
Alteryx Logic:
if IsNull([Row-1:Sales]) or [Row-1:Sales]=0
then
(if [Row-1:Gross Inventory] - [Sales] > 0
then [Row-1:Gross Inventory] - [Sales]
else [Row-1:Gross Inventory]/[Sales]
endif)
else 0
endif
KNIME Expression that is partially working:
if (
($[“Sales”, -1] == MISSING) or ($[“Sales”, -1] == 0),
if (
($[“Gross Inventory”, -1] == MISSING) or ($[“Sales”] == MISSING),
MISSING,
if (
($[“Gross Inventory”, -1] - $[“Sales”]) > 0,
$[“Gross Inventory”, -1] - $[“Sales”],
if (
($[“Sales”] != 0),
$[“Gross Inventory”, -1] / $[“Sales”],
MISSING
)
)
),
0
)
I used a field RecordID in Alteryx to help do this comparison.
Thanks for anyone that can review and provide guidance or suggestions.
Multi-row_Alteryx_KnimeMigration_example.knwf (158 KB)