Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Finding Average based on column name criteria

csprch
5 - Atom

Hi I have a dataset where prices are entered on columns with their exact dates but I intend to transform the data into a table that finds the average of the Months based on the column dates. 

I have provided an example to illustrate my current database. 

An example of my current data is : 

clipboard_image_0.png


I would want to create a table that output would look like this: 

clipboard_image_1.png

 

I intend to create a table that would be able to update with new data every month so could anyone guide me in the right direction?

Thank you!



2 REPLIES 2
JosephSerpis
17 - Castor
17 - Castor

Hi @csprch I mocked up a workflow that I think answers your question. Let me know what you think?

estherb47
15 - Aurora
15 - Aurora

Hi @csprch 

 

You can transpose the data, and then use a formula tool to create a new header based on the date. This function will pull just the month and year out: Substring([Name],FindString([name], " ")+1,length([Name])-FindString([name], " "))

Then a crosstab with Average builds back the desired table.

 

image.png

 

Let me know if this helps. You can add a dynamic rename to make the column headers exactly as desired, at the end. Rename by a formula on the 2 Month columns. Regex_Replace([_CurrentField_]),"(.*)_(.*)_(.*)","$2 $3 $1")

 

Cheers!

Esther

Labels
Top Solution Authors