Alteryx Designer Desktop Discussions

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

Macro Dynamic Formula

Dureyyyyy
5 - Atom

Hi! 

I am fairly new at Alteryx and I am playing with Macros. I have this dataset that I want to do a computation based on a excel configuration file. Basically, what it should do is from the formula written in an Excel file, the macro should compute all the necessary records based on the provided formula. However, I am having difficulty when the formula requires record that is not on the same row. You may see the table below as an example of my dataset. 

 

CategoryCodeColumns1Column1Column2VATColumn/VATColumns2Column3Column4VAT2Column/VAT2% SpendSpend  Coverage
TOTAL MIXTOTAL[I : Columns1] + [II : Columns1][I : Column1] + [II : Column1][I : Column2] + [II : Column2][I : VAT] + [II : VAT][I : Column/VAT] + [II : Column/VAT][I : Columns2] + [II : Columns2][I : Column3] + [II : Column3][I : Column4] + [II : Column4][I : VAT2] + [II : VAT2][I : Column/VAT2] + [II : Column/VAT2] 
TOTAL MIXI[IA : Columns1] + [IB : Columns1] + [IC : Columns1][IA : Column1] + [IB : Column1] + [IC : Column1][IA : Column2] + [IB : Column2] + [IC : Column2][IA : VAT] + [IB : VAT] + [IC : VAT][IA : Column/VAT] + [IB : Column/VAT] + [IC : Column/VAT][IA : Columns2] + [IB : Columns2] + [IC : Columns2][IA : Column3] + [IB : Column3] + [IC : Column3][IA : Column4] + [IB : Column4] + [IC : Column4][IA : VAT2] + [IB : VAT2] + [IC : VAT2][IA : Column/VAT2] + [IB : Column/VAT2] + [IC : Col
umn/VAT2]
[Columns2] / [Columns1][I : Column/VAT2] / [TOTAL : Column/VAT2]
TOTAL MIXIA[Column1] + [Column2]2723[Columns1] + [VAT][Column3] + [Column4]111519[Columns2] + [VAT2][Columns2] / [Columns1][IA : Column/VAT2] / [TOTAL : Column/VAT2]
TOTAL MIXIB[Column1] + [Column2]3824[Columns1] + [VAT][Column3] + [Column4]121620[Columns2] + [VAT2][Columns2] / [Columns1][IB : Column/VAT2] / [TOTAL : Column/VAT2]
TOTAL MIXIC[Column1] + [Column2]4925[Columns1] + [VAT][Column3] + [Column4]131721[Columns2] + [VAT2][Columns2] / [Columns1][IC : Column/VAT2] / [TOTAL : Column/VAT2]
TOTAL MIXII[Column1] + [Column2]51026[Columns1] + [VAT][Column3] + [Column4]141822[Columns2] + [VAT2][Columns2] / [Columns1]

[II : Column/VAT2] / [TOTAL : Column/VAT2

 

The macro that I am playing with is a macro I found here in the community also but I just modified it to work with my dataset. 


This is the screenshot of the macro:
Screenshot 2024-01-12 144006.png


This is what the macro can produce as of the moment. As you can see, it cannot compute for the last column as it requires record from other column that is not on the same row. 

Screenshot 2024-01-12 144356.png 

I attached the workflow below so it would be much easier to understand. Thank you for your help.

0 REPLIES 0
Labels