# Label data rows based on column values & calculate measures for each label group

**URL:** <https://forum.knime.com/t/label-data-rows-based-on-column-values-calculate-measures-for-each-label-group/82785>\
**Category:** KNIME Analytics Platform\
**Created:** [September 6, 2024, 7:55am UTC](https://forum.knime.com/t/label-data-rows-based-on-column-values-calculate-measures-for-each-label-group/82785 "2024-09-06T07:55:28Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [September 8, 2024, 7:07am UTC](https://forum.knime.com/t/label-data-rows-based-on-column-values-calculate-measures-for-each-label-group/82785/4 "2024-09-08T07:07:02Z")

</div>

@Er3n I think you can identify blocks of data like your trips like this:

> [@Move head rows to a column](https://forum.knime.com/t/move-head-rows-to-a-column/45094/2):
>
> @willy_oracle typically you would mark all lines with a [Counter](https://kni.me/n/pVT_aAQrO1Jkt9cG). Then identify the ‘headers’ with a rule engine [IF Col1 LIKE “Head\*” =\> Counter] and keep that (starting) row in a separate column. Then you [fill the missings with the previous value](https://forum.knime.com/t/replace-placeholder-with-values-from-above/38602/4) so a block would emerge marking the data table: [image] So now you have the blocks marked an can use a [Table Row to Variable Loop Start – KNIME Community Hub](https://kni.me/n/q7loejCZ1HWH5hUr) or [Group Loop Start – KNIME Community Hub](https://kni.me/n/7a8fxq51Z1jrgXeM) to do something with the blocks (export them delet…

You might define the start of a trip by using rules employing a lag function where the previous row is not null and the current one is and the previous counter is different.

You might have to look out for edge cases where there are very short entries.

If you use the column expression node you will have to [activate the multi row access](https://forum.knime.com/t/datetimediff-in-column-expression/74434/4).

> **[KNIME Snippets (3) — Rules and Conditions do apply](https://medium.com/low-code-for-advanced-data-science/knime-snippets-3-rules-and-conditions-do-apply-72b6ffbd4c9f)**
>
> Part 3 in a series of smaller KNIME related topics I came across over the years and that you might find interesting

I might build a sample later.

---

_[View the full topic](https://forum.knime.com/t/label-data-rows-based-on-column-values-calculate-measures-for-each-label-group/82785)._
