Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
fasibaig
Contributor III
Contributor III

Set Analysis and IF (Any possibility of Avoiding IF)

Dear Guru's

Is there any possibility to avoid the IF statement in the below expression as the performance is too slow Any Suggestions.

=IF (KPI_Name = 'Net Profit',

  (Sum({ <[TIME_PERIOD]={'PTD'},[HEADER_TYPE]={1},[REP_HEADER_ID]={'PLT12'}>} AGGR_ACT_PTD*-1)/1000),

IF (KPI_Name = 'Revenue',

  (Sum({ <[TIME_PERIOD]={'PTD'},[HEADER_TYPE]={1},[REP_HEADER_ID]={'PLT1'}>} AGGR_ACT_PTD*-1)/1000),

IF (KPI_Name = 'Sales Volume (kMT)',

  (Sum({ <[TIME_PERIOD]={'PTD'},[HEADER_TYPE]={1},[REP_HEADER_ID]={'SL'}>} AGGR_ACT_PTD)/1000),

  )))

 

Thanks & Regards

Ishaq

3 Replies
alexandros17
Partner - Champion III
Partner - Champion III

The idea is creating a new table (load * inline)  to match KPI_NAME and REP_HEADER_ID so that a value of KPI_NAme correspont to a value of REP_HEADER_ID, in this way you could use only 1 expression ...

Let me know

mato32188
Specialist
Specialist

Hi Ishaq,

it is better to create a flag using fields and values mentioned above...

if ( TIMEPERIOD = 'PTD' AND KPI_Name = 'NetProfit', '10',

     if (TIMEPERIOD = 'PTD' AND ...

          ...

               ... as @TP&KPI    (creation depends on what is logic to concat)

Then in expression just use sum({<@TP&KPI = {'10'}>} values) ...

BR

Martin

ECG line chart is the most important visualization in your life.
fasibaig
Contributor III
Contributor III
Author

Thanks for the quick replies. Below screen shot shows my requirement. I would like to list all the KPI's in the Chart and Use Set Analysis to show the Values without using IF. Is it possible to use the suggested ideas in this scenario.

Thanks & Regards

Ishaq

img1.png