adding total group by user

Hi Team

I am seeking for a help to achieve total for each user as below

Input table

col1 col2
Test 20
Test 20
Tes1 30
test1 30

output email should be
Email to Test user

col1 col2
Test 20
Test 20
Total of Test 40

Email to test1 user

col1 col2
Tes1 30
test1 30
Total of Test1 60

Hi @madhumita3 ,

what I’d do is:

  • Use a row splitter node to separate the rows related to the Test user and the ones related to Tes1 and test1
  • For the Test user flow branch, use a groupby node to compute the total column, then concatenate the total sum row to the dataset (make sure to keep the same column names when you do it!)
  • Repeat the step above for the rows related to Tes1 and test1

Have a nice evening,
Raffaello Barri

1 Like

is “Tes1” a typo which should be corrected? In that case a single Groupby node could be used.

Sorry its a Test1 , I have 200 of users I just gave an example will simple group by work here?

Should work fine. Try it with sum aggregation.

1 Like

I didn’t realize it will be that much simple, thank you for direction it did work for me.

I want to replace the last row with Total and user column blank screen shot below and I also attached Knime file
Sum_per_Groups.knwf (15.9 KB)

image

I deleted my workflow. The joins don’t work properly. Let me take a look at your desired format. Can there be more than two tests per user?

yes its a dynamic report, I have attached my workflow and I am able to achieve it the calculation now problem is formatting how to add Total word in last row of calculation example given in screenshot?

What’s the difference between GroupColumn and User?

I am just giving an example in my case I have live data which will contain actual user name and office location, so I have to group by user and offices so here I am using groupcolumn as a office just an example…

I revised your workflow. It produces this. If you have problems, let me know. I had to add a dummy row (and remove it later) to get the Column Expressions to work properly.

1 Like

Thank you, my requirement slightly different, I have changed the value example

User Test1 has tagged for group value b10 and b11 and I want them to calculate separately its not calculating correctly attached the latest data
Sum_per_Groups.knwf (19.9 KB)

This should work; however I’m afraid this is becoming so complicated that any workflow is likely to be fragile to more arbitrary changes. I tested this workflow with your last dataset and it worked which gives me some comfort.

4 Likes

Thank you so much for your help,. it did work for me

You’re very welcome. Glad it worked.

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