Skip to main content
Solved

I have a csv file where I want to calculate the sum of a respective attribute which have the same ID. In the example below I want to sum the values of v2 and add it in the correct place for id = 22, then go onto the next "group", thanks!

  • October 12, 2023
  • 6 replies
  • 225 views

id,v1,v2,v3,v4,v5

22,hi,hi,1,2,3

22,hi,hi,1,2,3

22,,,,,

33,hi,hi,2,3,4

33,hi,hi,2,3,4

33,hi,hi,2,3,4

33,,,,,

44,no,no,5,5,5

44,no,no,5,5,5

44,no,no,5,5,5

44,no,no,5,5,5

44,no,no,5,5,5

44,,,,,

Best answer by nielsgerrits

I probably do not understand what you need. Can you add you expected output?

I still do not understand why one would want this :D but the attached workspace produces what you asked for.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

6 replies

nielsgerrits
VIP
Forum|alt.badge.img+60
  • 2938 replies
  • October 12, 2023

You can do this using the StatisticsCalculator. Group by id.


  • Author
  • 3 replies
  • October 13, 2023

Thanks! But how do I place the values found in the empty columns in the final row of each "group"?


nielsgerrits
VIP
Forum|alt.badge.img+60
  • 2938 replies
  • October 13, 2023

Thanks! But how do I place the values found in the empty columns in the final row of each "group"?

I probably do not understand what you need. Can you add you expected output?


  • Author
  • 3 replies
  • October 13, 2023

I probably do not understand what you need. Can you add you expected output?

id,v1,v2,v3,v4,v5

22,hi,hi,1,2,3

22,hi,hi,1,2,3

22,,,sumv2,summv3,sumv4,sumv5

33,hi,hi,2,3,4

33,hi,hi,2,3,4

33,hi,hi,2,3,4

33,,,sumv2,summv3,sumv4,sumv5

44,no,no,5,5,5

44,no,no,5,5,5

44,no,no,5,5,5

44,no,no,5,5,5

44,no,no,5,5,5

44,,,sumv2,summv3,sumv4,sumv5


nielsgerrits
VIP
Forum|alt.badge.img+60
  • 2938 replies
  • Best Answer
  • October 13, 2023

I probably do not understand what you need. Can you add you expected output?

I still do not understand why one would want this :D but the attached workspace produces what you asked for.


  • Author
  • 3 replies
  • October 13, 2023

I probably do not understand what you need. Can you add you expected output?

Thank you very much! Is part of a larger system which has its requirements, odd as they may be.