Alteryx Designer Desktop Discussions

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

Issues with Summarizing multiple fields at once

Ramon_dup_257
6 - Meteoroid

I am trying to Aggregate multiple rows using the Summarize tool.

 

My data looks like this :

P1 M1 D0    
P1 M1 D1 D2  
P1 M1     D3

 

 

I want to group by P1 and M1 and want to take the last not-null value in the columns containing D1, D2 and D3.

 

When I use the summarize tool, I group on P1 and M1 and pick the last value for each of the D-columns.

 

What I want is :

P1 M1 D1 D2 D3

 

What I am getting is :

P1 M1     D3
         

 

I think what might be happening is that the summarize tool is picking up the last value of the other D-columns as null and giving me the result accordingly.

 

Also, the D-fields are string fields and thus I cannot use the Max operation.

 

Is there a way to pick the last non-null value for the columns ?

 

I understand that I can summarize the individual columns and join them with the rest of the columns but it does not seem like a good approach to me as I have a sufficiently large number of columns to run the operation on.

 

Thanks.

8 REPLIES 8
MarqueeCrew
20 - Arcturus
20 - Arcturus

A simple answer might be:

 

Groupby P1

Groupby M1

MAX D1

MAX D2

MAX D3

 

Is that a valid solution?

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Ramon_dup_257
6 - Meteoroid

I forgot to include that the columns are String fields and thus the max operation won't work.

I edited my original post to reflect this.

 

Apologies.

MarqueeCrew
20 - Arcturus
20 - Arcturus

I've created a module that uses a mult-row formula (3) to perpetuate the last value.

 

Capture1.PNG

 

I hope that this will help to solve your problem.

 

Thanks,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Ramon_dup_257
6 - Meteoroid

This was also the solution that I had in mind Smiley Happy

 

However, I will have to put in about 7 Multi-Row Formula for my purpose.

 

Is there a way to use the a Multi-Row Formula across multiple fields as well ?

 

Until then, this was the best answer.

 

Thanks!

MarqueeCrew
20 - Arcturus
20 - Arcturus

Here's a version that is more dynamic for you:

 

Capture.PNG

 

This might be the better answer that you were hoping for?

 

Thanks,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Ramon_dup_257
6 - Meteoroid

This works exactly as I expected!

Thank you so much!

Ramon_dup_257
6 - Meteoroid

@MarquuCrew, I realised that my problem is a little more layered than I previously anticipated. I have two attribute fields (A and B, non-numeric) for each of the Fields F1 through F7. which I need to populate as well.

Your solution while correct for the previous half of the problem will only pick the last values for A and B in the P1-M1 combo.

 

My table structure currently is  :

 

Input

 

The output should be like :

 

Output

 

Do you have any suggestions for leads on this problem ?

MarqueeCrew
20 - Arcturus
20 - Arcturus

@Ramon_dup_257, If you modify the solution to include a record id after you read the input & put that record ID as a KEY field into the transpose....

 

That should solve the issue.  I've included a sample module for you (version 3).  Please try this yourself before you look at the solution.  I tested with your single record example and got the desired result.

 

Thanks,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Labels