Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Sum diagonal values in Alteryx

igorfv
8 - Asteroid

Hi Guys,

 

I hope that all are well. I need sum diagonal values in a matrix (table) with Alteryx. How do solve this problem?

 

Example:

 

igorfv_0-1651920479346.png

 

Thanks!

Igor Valle

6 REPLIES 6
DataNath
17 - Castor
17 - Castor

How extensive is your table? In this instance you could do it with a simple multi-row formula using [C]+[Row-1:B]+[Row-2:A]. However, if you have a load of columns you may need to start looking at transformation and likely macros to handle the logic. Can you provide a screenshot/sample of the size of the live dataset if this isn’t the case?

DataNath
17 - Castor
17 - Castor

Just re-read the table based on the colouring and that actually wouldn’t work sorry! If nobody offers up a solution I’ll have a play around with this tomorrow.

igorfv
8 - Asteroid

Hi DataNath,

 

Thank you for your help. My table/matrix has a maximum size of 244 rows and 100 columns.

 

Igor Valle

igorfv
8 - Asteroid

I found a way but it only works for tables of equal sizes. For different sizes, it doesn't work.

 

igorfv_0-1651924506939.png

 

igorfv_1-1651924568105.png

 

patrick_digan
17 - Castor
17 - Castor

@igorfv See if the attached works for you. It took a few extra tools, but it should work for tables of different sizes. The thought is to get a rowID and ColumnID for each cell, and then sum it together do each cell. Notice that diagonals all have the same sum:

 

patrick_digan_0-1651940145875.png

 

patrick_digan_1-1651940174688.png

 

igorfv
8 - Asteroid

Hi patrick_digan,

 

It's worked very well. Have a nice day!

 

Thak you!

Igor Valle

Labels
Top Solution Authors