Important Community update: The process for changing your account details was updated on June 25th. Learn how this impacts your Community experience and the actions we suggest you take to secure your account here.

Alteryx Designer Desktop Discussions

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

INCREMENTALLY DECREASE A THRESHOLD VALUE TILL A CONDITION IS MET

Shahas
8 - Asteroid

Hi Everyone,

This is a repeat question as i couldn't get an answer earlier. Below is the workflow stage I'm at.

Shahas_0-1680191256307.png


After this stage, I have to check for the sum of New Delta. If it's above 20k, the threshold of 'abs([Delta Adj])' has to be decreased 500 every time until the sum of New Delta is below 20k. 

I believe we need to use a iterative macro here. As I haven't worked using macro, would be grateful to anyone who can assist on the same.

 

Thanks in advance

 

16 REPLIES 16
Pang_Hee_Choy
12 - Quasar

@Shahasyes, we are reducing values of Delta Adj by 500 in each row.

 

and, I tired on guessing. I more preferred tables.

Please provide tables in every step, with explanation.

 

 

 

 

Shahas
8 - Asteroid

@Pang_Hee_Choy heyy... I will try to explain step by step.

 

After initial basic steps, I had to apply a threshold based on Delta Adj, ie, if its < 20k, the value will be 0 and rest every rows will be kept as it is.

 

Shahas_0-1680512882123.png

 

This is the way I did it. At this point, data looks like this :

 

Original deltaDelta Adj
3500035000
3356833568
3000030000
2800028000
194500
187000
122000
90000
35000

 

Then the formula is applied, New Delta = Delta Adj+ Original Delta

 

Now the data looks like this : 

 

Original deltaDelta AdjNew Delta
350003500070000
335683356867136
300003000060000
280002800056000
19450019450
18700018700
12200012200
900009000
35000

3500

 

Here onwards, we have to check the sum of New Delta. If its above 20k, the threshold which we applied in the 1st screenshot has to be reduced by 500 to 19500 and so on till we have the sum of new Delta < 20k.

 

So what I require is to have the threshold to be reduced incrementally till the sum of New Delta is below 20k.

 

Let me know if anything is not clear or any further details are required

Pang_Hee_Choy
12 - Quasar

@Shahas 

 

if I understand correctly.

 

at start, threshold for rows 20k

if total new delta >20kthreshold for rows will -500 to 19,500

until total new delta <=20k?

 

Original deltaDelta AdjNew Deltaremark
350003500070000delete as new delta more than 20k
335683356867136delete as new delta more than 20k
300003000060000delete as new delta more than 20k
280002800056000delete as new delta more than 20k
19450019450sum for first round, as threshold is 20k
18700018700sum for first round, as threshold is 20k
12200012200sum for first round, as threshold is 20k
900009000sum for first round, as threshold is 20k
35000

3500

sum for first round, as threshold is 20k

 

till 3rd round, 19450 is exclude as threshold now is 19000, but sum of new delta is still 20k.

Original deltaDelta AdjNew Deltaremark
19450019450delete as new delta more than 19000
18700018700remain as threshold is 19000
12200012200remain as threshold is 19000
900009000remain as threshold is 19000
35000

3500

remain as threshold is 19000

 

till the end, threshold for row is 12000, sum of new delta is less than 20k (Final output)

Original deltaDelta AdjNew Deltaremark
900009000remain as threshold is 12000
35000

3500

remain as threshold is 12000

Shahas
8 - Asteroid

@Pang_Hee_Choy 

"at start, threshold for rows 20k

if total new delta >20kthreshold for rows will -500 to 19,500

until total new delta <=20k?" - This is the logic

 

After every iteration, sum of new delta has to be checked.. 

 

So, from the example above, threshold of 12000 will be correct.


And in the output Original Delta, Delta Adj & New Delta should be present.

Pang_Hee_Choy
12 - Quasar

here the update version.

Pang_Hee_Choy_0-1680575302490.png

formula for first filter:

[New Delta] <= (20000 - (500 * [Engine.IterationNumber]))

x

Shahas
8 - Asteroid

HEYY @Pang_Hee_Choy thanks for the updated version.

 

could u please explain at which step are we reducing the delta adjustment threshold? Just enquiring

Pang_Hee_Choy
12 - Quasar

the first filter.

 

[New Delta] <= (20000 - (500 * [Engine.IterationNumber]))

 

1st cycle = 20000 - (500 *0) = 20000

2nd cycle = 20000 - (500 *1) = 19500 

...so on

Labels