Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
joefeyas
Contributor II
Contributor II

Question about optimizing a chart expression

Right now we are using this type of expression in our charts:

if(vPrice='net', sum(net sales), sum(gross sales))

Would it be a more optimal (by that I mean faster) choice to use 2 expressions with an enable condition?

sum(net sales)   <-- enable condition  (vprice = 'net')

sum(gross sales)   <-- enable conditon  (vprice = 'gross')

What I would like to know is, if the expression fails the condition and is disabled from chart, is there any calculation going on by QV?  Also is there any overhead in using a condition on a chart expression?

TIA

6 Replies
Sunil_Chauhan
Champion
Champion

sum (if( vPrice='net', net sales,gross sales))

sudeepkm
Specialist III
Specialist III

I've seen with around 200K records having multi level "if else" block inside single expression caused Out of Object Memory issue in my dashboard. so I used multiple conditional expressions instead.

You can always use Error Messages to display Custom Messages to the end users in case of errors in the calculation.

alexandros17
Partner
Partner

The enable condition must be computed anyway so I should prefer the initial If.

If you have to export in excel the enable condition slow a lot  the operation.

Sunil_Chauhan
Champion
Champion

writing expression  at UI slow downs the performance of application

so we should try to write in script.

like above expression

in Script   if( vPrice='net', net sales,gross sales) as Sales

and In UI write sum(Sales)

hope this helps

joefeyas
Contributor II
Contributor II
Author

The variable is set by the user (via drop down) in the GUI.   So writing it in the script is not an option.

Thanks,

Sunil_Chauhan
Champion
Champion

better u can use below

sum (if( vPrice='net', net sales,gross sales))