Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
deepak_km9886
Creator
Creator

Equivalent set analysis of if expression

I have this following expression ,  but it is taking too much of time.

if([Price incurred]=0,0,sum(Price)/(1-vField/100)-sum(Profit))

Can anyone give me alternate expression for the above one,

vField is variable

9 Replies
Ivan_Bozov
Luminary
Luminary

You can do it in the load script so it is going to be much faster on the front end.

vizmind.eu
OmarBenSalem

Maybe:

sum({<[Price incurred]={0}>}Price) / ((1-vField/100) -sum({<[Price incurred]={0}>}Price))

deepak_km9886
Creator
Creator
Author

The else part should be when [price incurred ]is not equal to zero., else it should be zero.Does your expression yields 0 when the values in [price incurred] is zero?

ChennaiahNallani
Creator III
Creator III

Create variable for

vField_1 = 1-vField/100

and Try like below.

sum({<[Price incurred] -= 0>}Price)/(vField_1-sum({<[Price incurred] -= 0>}Profit))

OmarBenSalem

I misread:

try;:

sum({<[Price incurred]=-{0}>}Price) / ((1-vField/100) -sum({<[Price incurred]=-{0}>}Price))


this will calculate the sum(Price) expect when the Price icnurred=0, thus, it would not be included in the calculation (as if it was = 0)

deepak_km9886
Creator
Creator
Author

This is not giving any values in the column in table. I'm just seeing 0's

balabhaskarqlik

What exactly you want to achieve from your current expression as well as Set analysis.

deepak_km9886
Creator
Creator
Author

I have some 22lakh of records, if i use that if statement it take lot of time to load the table view. So i'm looking for an alternate expression that replaces if expression giving me same values in table.

The expression is a measure in one of the column in the table.

manoj217
Creator III
Creator III

you are having more records in your data so try to do in back end script.

f([Price incurred]=0,0,sum(Price)/(1-vField/100)-sum(Profit))

make this as one field sum(Price)/(1-vField/100) and use in front end. because while reloading itself these calculations will done so it will increase the performance.

if you use the same expression in ui means while opening the doc it will perform the calculations so performance will be poor