Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
anu
Partner - Contributor III
Partner - Contributor III

simplifying to reduce repetitive set conditions in expressions

Hi Folks,
 
I am looking for simplification of chart/kpi expressions from last few days for an existing qliksense app. The app has quite a large no. of objects with such expressions which is slowing it down.  I'm not able to figure out a simple way to do this. Looking for any help and suggestions.
pls find one sample expression below:
This is for calculating change in distance travelled since last week.
 
Num((((Sum({< [delivery_completion_date]=P({<[delivery_completion_date]={">=$(=date(vCurr_wk_start,'YYYY/MM/DD'))<=$(=date(vCurr_wk_end,'YYYY/MM/DD'))"},Date=,WeekYear_Num=,WeekYear=,MonthYear=>}),MonthYear=,Date= ,WeekYear=,WeekYear_Num=,[safety_ex]={'N'} , [max_dist_km]={">0"} , Category={"g"}, max_dispatch_dist={'Y'} >} [max_dist_km] )
/
Sum({< [delivery_completion_date]=P({<[delivery_completion_date]={">=$(=date(vCurr_wk_start,'YYYY/MM/DD'))<=$(=date(vCurr_wk_end,'YYYY/MM/DD'))"},Date=,WeekYear_Num=,WeekYear=,MonthYear=>}),MonthYear=,Date=, WeekYear_Num=,WeekYear=,[safety_ex]={'N'} , [max_dist_km]={">0"} , Category={"g","r","y"}, max_dispatch_dist={'Y'} >} [max_dist_km]) )
-
(Sum({< [delivery_completion_date]=P({<[delivery_completion_date]={">=$(=date(vlast_wk_start,'YYYY/MM/DD'))<=$(=date(vlast_wk_end,'YYYY/MM/DD'))"},Date=,WeekYear_Num=,WeekYear=,MonthYear=>}),MonthYear=,Date= ,WeekYear=,WeekYear_Num=,[safety_ex]={'N'} , [max_dist_km]={">0"} , Category={"g"}, max_dispatch_dist={'Y'} >} [max_dist_km] )
/
Sum({< [delivery_completion_date]=P({<[delivery_completion_date]={">=$(=date(vlast_wk_start,'YYYY/MM/DD'))<=$(=date(vlast_wk_end,'YYYY/MM/DD'))"},Date=,WeekYear_Num=,WeekYear=,MonthYear=>}),MonthYear=,Date=, WeekYear_Num=,WeekYear=,[safety_ex]={'N'} , [max_dist_km]={">0"} , Category={"g","r","y"}, max_dispatch_dist={'Y'} >} [max_dist_km]) )
)),'0.0%')
 
1 Solution

Accepted Solutions
marcus_sommer

There are probably not many possibilities to optimize this expression directly.

More effects would have to reduce the number of concurrent visible objects respectively to merge multiple objects. The last means not to use n separate KPI objects else using a table-chart for them. This reduced layout-options but it would also reduce the efforts to develop and maintain the UI.

Further some of the expression-conditions might be transferrable to the dimensional layer - with and/or without adjustments to the data-model. The data-model itself is very important for the UI performance - officially recommended as best compromise in regard to efforts, readability, maintainability and performance is a star-scheme data-model.

- Marcus

View solution in original post

1 Reply
marcus_sommer

There are probably not many possibilities to optimize this expression directly.

More effects would have to reduce the number of concurrent visible objects respectively to merge multiple objects. The last means not to use n separate KPI objects else using a table-chart for them. This reduced layout-options but it would also reduce the efforts to develop and maintain the UI.

Further some of the expression-conditions might be transferrable to the dimensional layer - with and/or without adjustments to the data-model. The data-model itself is very important for the UI performance - officially recommended as best compromise in regard to efforts, readability, maintainability and performance is a star-scheme data-model.

- Marcus