Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
joefeyas
Partner - Contributor II
Partner - 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
SunilChauhan
Champion
Champion

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

Sunil Chauhan
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 - Champion III
Partner - Champion III

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.

SunilChauhan
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

Sunil Chauhan
joefeyas
Partner - Contributor II
Partner - 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,

SunilChauhan
Champion
Champion

better u can use below

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

Sunil Chauhan