topic Set analysis performance optimization - reduce if function interaction in Qlik Sense App Development
https://community.qlik.com/t5/Qlik-Sense-App-Development/Set-analysis-performance-optimization-reduce-if-function/m-p/1666121#M50137
<P>Hi,</P><P>I'm developing an app caracterized by 4 level of variables, in which each upper level variables recall lower level ones. The measures included into the variables can't be developed in back end script. T<SPAN>he upper level variables generate a long script visualized in expression information (see the attachment).</SPAN></P><P>The issue we're facing is related with IF function in expression, like that presented below, where an upper variable is evaluated several times within the IF generating a really long script and long lag in front end result visualization.</P><P>IF ($(score) >= SUM({<ID_PV_INDICE={'IPIMB'}>} POINTS),'Risk very low',<BR />IF ($(score) > SUM({<ID_PV_INDICE={'IPIMA'}>} POINTS)<BR />and $(score) <= SUM({<ID_PV_INDICE={'IPIA'}>} POINTS) ,'Risk high',<BR />IF ($(score) > SUM({<ID_PV_INDICE={'IPIA'}>} POINTS)<BR />and $(score) <= SUM({<ID_PV_INDICE={'IPIM'}>} POINTS) ,'Risk medium',<BR />IF ($( score) <= SUM({<ID_PV_INDICE={'IPIMA'}>} POINTS) ,'Risk very high',<BR />'Risk low'<BR />))))</P><P>May anybody suggest an alternative function that enables better performance providing the variables "score" in expression just one time (like properties of the switch function in back end)?</P><P>Thanks, best regards.</P><P>Davide</P>Thu, 16 Jan 2020 09:13:58 GMTdavdiste2020-01-16T09:13:58ZSet analysis performance optimization - reduce if function interaction
https://community.qlik.com/t5/Qlik-Sense-App-Development/Set-analysis-performance-optimization-reduce-if-function/m-p/1666121#M50137
<P>Hi,</P><P>I'm developing an app caracterized by 4 level of variables, in which each upper level variables recall lower level ones. The measures included into the variables can't be developed in back end script. T<SPAN>he upper level variables generate a long script visualized in expression information (see the attachment).</SPAN></P><P>The issue we're facing is related with IF function in expression, like that presented below, where an upper variable is evaluated several times within the IF generating a really long script and long lag in front end result visualization.</P><P>IF ($(score) >= SUM({<ID_PV_INDICE={'IPIMB'}>} POINTS),'Risk very low',<BR />IF ($(score) > SUM({<ID_PV_INDICE={'IPIMA'}>} POINTS)<BR />and $(score) <= SUM({<ID_PV_INDICE={'IPIA'}>} POINTS) ,'Risk high',<BR />IF ($(score) > SUM({<ID_PV_INDICE={'IPIA'}>} POINTS)<BR />and $(score) <= SUM({<ID_PV_INDICE={'IPIM'}>} POINTS) ,'Risk medium',<BR />IF ($( score) <= SUM({<ID_PV_INDICE={'IPIMA'}>} POINTS) ,'Risk very high',<BR />'Risk low'<BR />))))</P><P>May anybody suggest an alternative function that enables better performance providing the variables "score" in expression just one time (like properties of the switch function in back end)?</P><P>Thanks, best regards.</P><P>Davide</P>Thu, 16 Jan 2020 09:13:58 GMThttps://community.qlik.com/t5/Qlik-Sense-App-Development/Set-analysis-performance-optimization-reduce-if-function/m-p/1666121#M50137davdiste2020-01-16T09:13:58ZRe: Set analysis performance optimization - reduce if function interaction
https://community.qlik.com/t5/Qlik-Sense-App-Development/Set-analysis-performance-optimization-reduce-if-function/m-p/1666128#M50138
<P>may be this</P><LI-CODE lang="javascript">Pick(match(-1,
$(score) >= SUM({<ID_PV_INDICE={'IPIMB'}>} POINTS),
$(score) > SUM({<ID_PV_INDICE={'IPIMA'}>} POINTS)
and $(score) <= SUM({<ID_PV_INDICE={'IPIA'}>} POINTS) ,
$(score) > SUM({<ID_PV_INDICE={'IPIA'}>} POINTS)
and $(score) <= SUM({<ID_PV_INDICE={'IPIM'}>} POINTS) ,
$( score) <= SUM({<ID_PV_INDICE={'IPIMA'}>} POINTS))+1,
'Risk low'
'Risk very low',
'Risk high',
'Risk medium',
'Risk very high',
)</LI-CODE>Thu, 16 Jan 2020 09:30:46 GMThttps://community.qlik.com/t5/Qlik-Sense-App-Development/Set-analysis-performance-optimization-reduce-if-function/m-p/1666128#M50138kush1410872020-01-16T09:30:46ZRe: Set analysis performance optimization - reduce if function interaction
https://community.qlik.com/t5/Qlik-Sense-App-Development/Set-analysis-performance-optimization-reduce-if-function/m-p/1666134#M50142
<P>Thanks Kush, </P><P>but also in the pick match function the variables $(score) is recalled several times and the interaction are similar at IF the original function.</P><P> </P>Thu, 16 Jan 2020 09:43:11 GMThttps://community.qlik.com/t5/Qlik-Sense-App-Development/Set-analysis-performance-optimization-reduce-if-function/m-p/1666134#M50142davdiste2020-01-16T09:43:11ZRe: Set analysis performance optimization - reduce if function interaction
https://community.qlik.com/t5/Qlik-Sense-App-Development/Set-analysis-performance-optimization-reduce-if-function/m-p/1666154#M50145
<P>But it will be faster as compared to if condition. Please validate that</P>Thu, 16 Jan 2020 10:28:58 GMThttps://community.qlik.com/t5/Qlik-Sense-App-Development/Set-analysis-performance-optimization-reduce-if-function/m-p/1666154#M50145kush1410872020-01-16T10:28:58ZRe: Set analysis performance optimization - reduce if function interaction
https://community.qlik.com/t5/Qlik-Sense-App-Development/Set-analysis-performance-optimization-reduce-if-function/m-p/1666196#M50154
<P>Does $(score) need to be evaluated at each dimension value or can it be calculated over all data? </P><P>-Rob</P>Thu, 16 Jan 2020 12:06:06 GMThttps://community.qlik.com/t5/Qlik-Sense-App-Development/Set-analysis-performance-optimization-reduce-if-function/m-p/1666196#M50154rwunderlich2020-01-16T12:06:06ZRe: Set analysis performance optimization - reduce if function interaction
https://community.qlik.com/t5/Qlik-Sense-App-Development/Set-analysis-performance-optimization-reduce-if-function/m-p/1666197#M50155
<P>Hi <LI-USER uid="336"></LI-USER> have you tested that pick/match is faster than if()? I have not found it to be faster.</P><P>-Rob</P>Thu, 16 Jan 2020 12:07:36 GMThttps://community.qlik.com/t5/Qlik-Sense-App-Development/Set-analysis-performance-optimization-reduce-if-function/m-p/1666197#M50155rwunderlich2020-01-16T12:07:36ZRe: Set analysis performance optimization - reduce if function interaction
https://community.qlik.com/t5/Qlik-Sense-App-Development/Set-analysis-performance-optimization-reduce-if-function/m-p/1666199#M50156
<P><SPAN>Hi, at least need to be evaluated at each gerarchical dimension attribute. Thx</SPAN></P>Thu, 16 Jan 2020 12:08:25 GMThttps://community.qlik.com/t5/Qlik-Sense-App-Development/Set-analysis-performance-optimization-reduce-if-function/m-p/1666199#M50156davdiste2020-01-16T12:08:25ZRe: Set analysis performance optimization - reduce if function interaction
https://community.qlik.com/t5/Qlik-Sense-App-Development/Set-analysis-performance-optimization-reduce-if-function/m-p/1666246#M50162
<P><LI-USER uid="6148"></LI-USER> in one of my requirement I found it to be slightly faster as compared to if . I am not sure but may be it will depend on what kind of expression you are comparing on how much data. </P>Thu, 16 Jan 2020 13:50:33 GMThttps://community.qlik.com/t5/Qlik-Sense-App-Development/Set-analysis-performance-optimization-reduce-if-function/m-p/1666246#M50162kush1410872020-01-16T13:50:33Z