Compute for column values based on conditional substrings in the column names

It’s funny that you ask, after posting I had this idea on how to generalise my solution and I went to the “kitchen” right away. Here it is:

  1. split into mean and kind columns
  2. unpivot everything into a single column, no extras
  3. calc mean for each group
  4. transpose
  5. reunite columns (resulting table has empty rows)

This is not what I had in mind, however. Story thyme:
While reading your question, I had this spark in my head: Group Loop Start. Except that it groups rows, not columns. I would have to emulate that behaviour, so the obvious way was to extract the column names, boil it down to the groups, and use a Table Row to Variable Loop Start instead.
Then I could filter the table to one group with that variable.
Not sure how I’d have continued then. I wasn’t even aware of the postfix filter or the 1-row shortcut at that moment.
It might be useful though. Now I know the logical thing would be the unpivot node, but that guy doesn’t even need the Group Columns Loop mechanism.


grouped_unpivot.knwf (67.9 KB)

2 Likes