How to "do nothing"?
I have a situation where if a given condition is met I want to take action, but if it is not met, I don't want to do anything. The line item is of type number and setting it to 0 is not a viable option for the ELSE side. So how can I code "do nothing"?
Thanks in advance!
Answers
-
Create a new line item for this!
For example, say the original line item is A and the "action" taken if condition is met is to multiply it by 50
B= IF [condition] THEN A*50 ELSE A0 -
Thanks for the quick response. I'm trying to do this without adding a line item but I can certainly see how your solution would work.
0 -
Hey, yeah I'm afraid you can't reference a line item in its own formula, it's circular referencing which can't be done in Anaplan. You need another line item if you want to manipulate the data 🙂0
-
What type of condition are you applying, is it based on another line item or the result of the formula you're writing?0
-
It is based on another line item (boolean) and the action taken when true also involves another numeric line item.
0 -
And just so I understand, why wouldn't
IF Boolean.lineitem = false THEN 0 ELSE numeric.lineitem x 50?work?
0 -
The action I'm using is POST and since multiple time period can post to the same cell, 0 will override an existing value and I don't want that.
0 -
@dngingras I'm trying to think through the use case on this but I think I understand what you're trying to do.
I like @cianna.bramley and @CommunityMember83188 where you use a boolean, preferably from a system module (DISCO methodology)
But if you don't want to add another line item -
You can try using LEAD on the ELSE portion the same distance as the post. This will leave the value alone if it doesn't meet your condition.
For example,
IF Sales < 150 THEN POST(Sales, 2) + 100 ELSE LEAD(Sales, 2, 0)
0 -
In your example, the Jun value should be 230 but the LEAD function overwrite that value with the Aug Sales value. I actually got it to work by changing the logic of the line item I'm posting so that if the condition is not met, that line item becomes 0 and then the POST function gives the proper numbers.
Thank you all for your suggestions, much appreciated.
0 -
POST adds, it does not replace.
so you an do it. However the logical choice if to check the same condition on the formula where you POST and not do it.
1 -
I agree with you and that is what I was trying to do: if condition then post(x,y) else "do nothing"
OR: if not condition then "do nothing" else post(x,y)
Replacing "do nothing" by 0 does not work, so back to my original question: how to "do nothing"?
0