Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear All.
i have fields Product FullPrice And Price, From that i have calculated Discount.
i need the discount Range in ListBox
like
0-10 %
11-20 %
21-30 % and soon.
when ever i select 0-10 % it should show all the products details with inRange 0-10% discount.
and i don't want to do it in Edit Script.
i want to do it in Listbox Expression.
thanks,
Mukram.
Have you tried using an expression like
if ((Expression)>=.00 and (Expression)<=.1,'0-10 %',
if ((Expression)>=.11 and (Expression)<=.2,'11-20 %',
if ((Expression)>=.21 and (Expression)<=.3,'21-30 %')))
Hi Mukram,
If you dont want to change your script I would suggest that you make a variable which calculate your expression.
This variable then can be used in your expression.
Use CTRL + Alt + v to open your variabel overview.
Choos Add
Pick an name (fe VPercentage)
And add the calculation for your percentage as the definition.
in your case I think it will : FullPrice / (Price - FullPrice)
Now you can use $(vPercentage) everywhere in your Qlikview to show the discount percentage.
Also in your listbox expersion.
That should look like:
=IF ($(vPercentage) < 10 , '0-10%'
, IF ($(vPercentage) >= 11 and $(vPercentage) <= 20 , '10-20%'
, IF ($(vPercentage) >= 21 and $(vPercentage) <= 30 , '20-30%'
, IF ($(vPercentage) >= 31 and $(vPercentage) <= 40 , '30-40%'
, IF ($(vPercentage) >= 41 and $(vPercentage) <= 50 , '40-50%'
, IF ($(vPercentage) >= 51 and $(vPercentage) <= 60 , '50-60%'
, IF ($(vPercentage) >= 61 and $(vPercentage) <= 70 , '60-70%'
, IF ($(vPercentage) >= 71 and $(vPercentage) <= 80 , '70-80%'
, IF ($(vPercentage) >= 81 and $(vPercentage) <= 90 , '80-90%'
, IF ($(vPercentage) >= 91 , '90 + %'
))))))))))
Hope this is helpfull for you.
Good Luck,
Dennis.
I strongly recommend you to do it in the Script.
Remember if you put any logical expression in the front end it will execute everytime any one interact with the application. Look at your script and sometime a small design change can help you achieve great results.
Anyway if there is absolutely no way to do in the backend , you can try creating an expression in the list box as follows
=pick(if(Price=0,10,if(Price=100,1,Ceil(1-(Price/FullPrice),0.1)*10)),'0-10','10-20','20-30','30-40','40-50','50-60','60-70','70-80','80-90','90-100')
Test the logic multiple times before you use this expression.
May be you can think along these lines to get a different expression suitable for your scenario.
The attached file contains a small example of how you can try this approach.