Compare multiple Row within Same Column and give exception

Hi Knime Enthusisatic !!

I want your help in following issue:
I need to compare Row within same column and give output whether it is an exception or not.

Data sample:

Bill Number Material Price
101 A 20
101 A 25
101 A 35
101 A 0
102 B 34
102 B 39
103 C 88
103 C 89
103 C 89
104 D 90
104 D 90

Required Output:

Bill Number Material Price Exception of Bill Number and Material As whole Value Differnce against Highest
101 A 20 Yes, Price Difference 15
101 A 25 Yes, Price Difference 10
101 A 35 Yes, Price Difference 0
101 A 0 Yes, Price Difference 35
102 B 34 Yes, Price Difference 5
102 B 39 Yes, Price Difference 0
103 C 88 Yes, Price Difference 1
103 C 89 Yes, Price Difference 0
103 C 83 Yes, Price Difference 6
104 D 90 No, not Price Difference 0
104 D 90 No, not Price Difference 0

I am facing issue whenever I am trying to create loop.
Please help

Hey there,

you can achieve this by using a Group Loop and also the new Expressions node:

Here’s a prototype:

aggregation_exception.knwf (86.0 KB)

I note that the provided prices in your first table differ from those in the second on a per row basis - this confused me at the beginning at the results appeared to be different.

1 Like

Hello @ravi13
From my understanding you don’t need a loop operation for this task.

  • ‘Group By’ Bill, Material and Max Price as aggregation.
  • duplicate Price column and Group By Bill, Material Price and aggregated unique count duplicated price
  • then you can use joins to merge all back together.

Please share your thoughts if further support is needed.

BR

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.