Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have a requirement to optimize the below code in Qliksense. This code used in pivot table to change the background color.
The below code used in more than 10 pivot tables and it decrease the dashboard performance. Can you please suggest the alternatives or optimize the code.
Background color expression
if( (
sum({<AggregateOn = {'$(v_Aggregate_On)', 'NORMAL'}, Version = {'ACT'}, Year =, Month =, %Date.KEY = {">=$(vCurrentYear)00<=$(vCurrentPeriod)"}>}1 * _Date_Extra_CY_Flag) > 0
or sum({<AggregateOn = {'$(v_Aggregate_On)', 'NORMAL'}, Version = {'FY'}, Year =, Month =, %Date.KEY = {"$(vCurrentYear)12"}>}1 * _Date_Extra_FY_Flag) > 0
or sum({<AggregateOn = {'$(v_Aggregate_On)', 'NORMAL'}, Version = {'Q'}, Year =, Month =, %Date.KEY = {">=$(vCurrentYear)00<=$(vCurrentYear)12"}>}1 * _Date_Extra_Q_Flag) > 0
)
and (sum({<AggregateOn = {'$(v_Aggregate_On)', 'NORMAL'}, Version = {'AOP'}, Year =, Month =, %Date.KEY = {">=$(vPreviousYear)12<=$(vCurrentYear)12"}>}1) > 0 or Match(only({<Year =, Month =>}KPI), 'A', 'B', 'C'))
,
Pick(Match(only({<Year =, Month =>}KPI), 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z')
, if(Act >= -0.05 and Act <= 0.05 , GREEN(), RED()) //A
, if(Act >= -0.05 and Act <= 0.05 , GREEN(), RED()) //B
, if(Act >= -0.05 and Act <= 0.05 , GREEN(), RED()) //C
, if(Act-TGT >= 0, GREEN(), RED()) //D
, if(Act-TGT >= 0, GREEN(), RED()) //E
, if(Act-TGT >= 0, GREEN(), RED()) //F
, if(Act-TGT >= 0, GREEN(), RED()) //G
, if(Act-TGT <= 0, GREEN(), RED()) //H
, if(Act-TGT <= 0, GREEN(), RED()) //I
, if(Act-TGT <= 0, GREEN(), RED()) //J
, if(Act-TGT >= 0, GREEN(), RED()) //K
, if(Act-TGT >= 0, GREEN(), RED()) //L
, if(Act-TGT >= 0, GREEN(), RED()) //M
, if(Act-TGT <= 0, GREEN(), RED()) //N
, if(Act-TGT <= 0, GREEN(), RED()) //O
, if(Act-TGT >= 0, GREEN(), RED()) //P
, if(Act-TGT >= 0, GREEN(), RED()) //Q
, if(Act-TGT >= 0, GREEN(), RED()) //R
, if(Act-TGT <= 0, GREEN(), RED()) //S
, if(Act-TGT <= 0, GREEN(), RED()) //T
, if(Act-TGT >= 0, GREEN(), RED()) //U
, if(Act-TGT >= 0, GREEN(), RED()) //V
, if(Act-TGT <= 0, GREEN(), RED()) //W
, if(Act-TGT >= 0, GREEN(), RED()) //X
, if(Act-TGT <= 0, GREEN(), RED()) //Y
, if(Act-TGT <= 0, GREEN(), RED()) //Z
)
, White()
)
Thanks,
Krish
My suggestion would be to scrap this code entirely, get your specific requirements from the users/customers, and write a fresh expression from scratch matching those requirements. Given the level of complexity, I would also suggest considering writing a specific expression for each pivot table instead of using a generic one that covers all of the use cases for all the pivots.