I am looking at a calculation where I want to have C = IF A > 0 THEN B ELSE DO NOTHING...
DO NOTHING needs to retain previous value on C.
We cannot write a formula without else condition in the IF statement. I would suggest, creating another line item says IF A>0 then B else C. If you want to take the previous period's value you can also say IF A>0 then B else PREVIOUS(C).
I hope it helps!
Hi @jairam ,
As @kavinkumar Suggested that you can use previous function to get previous value of C. Please find the below screenshot.
This is possible using Previous function.
Previous Function Takes the Previous value of the same line item.
But your module should have Time as a dimension.
Are you looking to return the previous value of C as it relates to 'time' or as it relates to 'version'?
Previous time period = IF A >0 THEN B ELSE PREVIOUS(C)
Previous version = IF A > 0 THEN B ELSE PREVIOUSVERSION(C)
Thank you for the quick responses. It is my bad I did not frame the question correct. I was working with boolean in my case.
Formula: C = IF A then PREVIOUS(C) ELSE B
Then -> C = 100
When A = TRUE2nd Run: C value should remain as 100.But C is getting ZERO'd out.
I have tried to replicate your logic, i came up with few scenarios,let's say
Scenario 1. your first case A= false, B=100 then C should be 100, this working perfectly.
Scenario 2: Here my month started from Jan 20 so we don't have any previous value for C then in this case when A= True , B= 100 then all C = 0.
I think you may have encounter with this case.
Scenario 3: here A= True for Jan but false for Feb , B=100 then you can get the value for C except Jan 20
Hope this helps!
When I mean Previous, I meant Previous value in the same cell. (Not the previous period value).Please check the below flow of data:
Now setting A to TRUE:
Now changing Values in B. The C should retain 100 (previous value in same cell). - Ignore the calculated value.
Thank you in advance!
Lets not over complicate things! Why don't you create another line item D and say IF A then B else C as I suggested in my earlier post? Do you have any size constrain?
You cannot write a formula to retrieve the previous value in a cell.
As you mentioned Logic earlier: IF A then Previous(C) else B
and considering your scenario 3
Your Previous question : "Now changing Values in B. The C should retain 100 (previous value in same cell). - Ignore the calculated value."
and i didn't understand how and why C should retain 100.
can you explain in detail....?