Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
RÉSOLU

Creating new columns based on multiple columns

CFuser87
Météoroïde

Currently, I have various costs listed in excel by column.

 

GoodsSelling Type Cost 2024Selling Type Cost 2025Selling Type Cost 2026Selling Type Cost 2027Selling Type Cost 2028Selling Type Cost TotalAdmin Type Cost 2024Admin Type Cost 2025Admin Type Cost 2026Admin Type Cost 2027Admin Type Cost 2028Admin Type Cost Total
Alpha200100010020040010050050100200
Beta40020002004008002001000100200400

 

Ideally, I can transform this information into the following.

 

GoodsTotal Cost 2024Total Cost 2025Total Cost 2026Total Cost 2027Total Cost 2028Total Cost
Alpha3001500150300600
Beta60030003006001200

 

I've tried using multi row formula, but couldn't figure it out. Is there an easy way to do this without manually adding each year cost together using the formula tool.

4 RÉPONSES 4
binuacs
Arcturus

@CFuser87 are the Total Cost fields (eg: Total Cost 2024, 2025 etc) already present in your input file or need to calculate these fields?

CFuser87
Météoroïde

I would need to calculate the Total Cost fields (Selling + Admin Costs), and was wondering if there was an easy to way to add the fields together based on either position or name.

DataNath
Castor

Hey @CFuser87, how does something like this look?

 

3131.png

 

To outline the steps we:

1) Use a Dynamic Select to remove the 'Total' fields you have already

2) Transpose the data to get the field names into a single column ready for parsing

3) Parse the year from the field names

4) Cross-Tab, grouping by the year and using Sum as the aggregation, also ticking to add a Total Column

5) Dynamic Rename and Sort just to tidy things up into the desired format

 

The only thing is the totals are different to what you outlined in your expected outcome - in the example above your years add up to more than the 'Total Cost' so not sure if this was an error or there's extra logic to add here.

CFuser87
Météoroïde

Yep, this is what I was looking for. Learning how to use new formulas in the process. The total was weird because it only totaled 2025-2028. Thank you!!!

Étiquettes