Discussion board where members can get started with Qlik Sense.
I need help in making expression
Suppose I have months Oct2016, Nov2016 and Dec2016 and I have selected Oct2016
What I want is,
now if the above condition is not true say stock is greater than req then I want
if (stock<=req) //this time it would check for Nov2016 means stock value would come from this (stock=stock-req) and req value would be for Nov2016 and again the same condition
and this same goes on till Dec2016
But if the condition is true for any month then I have variable A with fixed value = 30 and I want
Assuming that 20 is the result of condition which is true
How I can achieve this?
Not so clear..
Could you please explain by using some sample data and expected output?
I have selected Oct2016
If (stock<=req) // (2000<=1000) which is not true
stock*30/req // Here this would fail as 2000 is greater than 1000
stock=stock-req // 2000-1000=1000 and the resultant value 1000 is now stock for Nov2016
If (stock<=req) // (1000<=500) which is again not true
stock*30/req // Here this would fail as 1000 is greater than 500
stock=stock-req // 1000-500=500 and the resultant value 500 is now stock for Dec2016
If (stock<=req) // (500<=1000) which in this case is true
stock*30/req // Here it would be 500*30/1000 = 15
now this value 15 should get added in variable A which has value 30.
A=A+15 // 30+15=45
A little change is highlighted
and variable A=30
and A=A+30 // 30+30 = 60
now this value 15 should get added in variable A which has value 60.
A=A+15 // 60+15=75
You can try
Where i have considered 50 as A.
Hope it helps.