How to sum certain columns without affecting other?
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
The first section is the two rows that I am starting with. I would like to sum the bolded columns (quantity, lbs, level) but keep the rest of the information that same so it reads as the second section. What tool would you suggest to achieve this output?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @akilbour ,
You can achieve that with the summarize tool. The documentation for the tool can be found below:
https://help.alteryx.com/current/designer/summarize-tool
Essentially you have to group by all the fields that are common between the two rows (Name,F8, FileName, New Field) that are non-numeric (apart from RecordID) and then sum all the numeric fields(quantity, gal, level).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Here's a screenshot of what the above would look like:
It will work as long as the values in the "group by" fields are consistent. Any differences will create a new row.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you @clmc9601 for the screenshot! I tried to use the summarize tool but for some reason, it will not let me select sum for the quantity, gal, and lb field. Do I need to change them from a V_wstring maybe?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Yes, that is correct @akilbour ,
You are only allowed to apply the sum operator on numeric fields only. So changing them to a Double or an Int if they are all integers will allow you to use the sum function.
