Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
We value your feedback – take our 5-minute QlikView modernization survey
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Simple expression to increase performance

Hi Team,

we are having around 100 different expressions similar to type 1 mentioned below. Having "IF" condition is decreasing performance. Can you please suggest some simple expression to get requirement.

we have two buttons, Next Quarter and Next Four Quarters. Based on user click it should calculate.

I am thinking ways to further reduce Type 2 to single expression something like

Sum({<QuarterYear={$(vNextQuarter)} + (vNext4QuartersButton * {$(vNextQuarter1), $(vNextQuarter2), $(vNextQuarter3)})>} Spend)

====================================================================================================

Type:1

-----------

if($(vNext4QuartersButton)=0,

  Sum({<QuarterYear={$(vNextQuarter)}>} Spend)

,

  Sum({<QuarterYear={$(vNextQuarter), $(vNextQuarter1), $(vNextQuarter2), $(vNextQuarter3)}>} Spend) )

====================================================================================================

Type:2

-----------

Sum({<QuarterYear={$(vNextQuarter)}>} Spend)

+

(vNext4QuartersButton * Sum({<QuarterYear={$(vNextQuarter1), $(vNextQuarter2), $(vNextQuarter3)}>} Spend))

====================================================================================================

1 Solution

Accepted Solutions
Not applicable
Author

I created a variable and passing the quarters flag to it when button is clicked. I did some performance analysis and found this is the only better solution without using IF condition.

=Sum({<QFlag = {$(vTP)}>} [Benchmark Savings])

For more information about creating the Flag, refer below document.

Fiscal Calendar Flag

Regards,

Sai Krishna,

View solution in original post

3 Replies
adamdavi3s
Master
Master

Using the pick & match functions can seriously improve functionallity over IF statements, take a look at those (search on here)

Not applicable
Author

Thank You. is there any way to write in single expressions like below?

Sum({<QuarterYear={$(vNextQuarter)} + (vNext4QuartersButton * {$(vNextQuarter1), $(vNextQuarter2), $(vNextQuarter3)})>} Spend)

Not applicable
Author

I created a variable and passing the quarters flag to it when button is clicked. I did some performance analysis and found this is the only better solution without using IF condition.

=Sum({<QFlag = {$(vTP)}>} [Benchmark Savings])

For more information about creating the Flag, refer below document.

Fiscal Calendar Flag

Regards,

Sai Krishna,