Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
helen_pip
Creator III
Creator III

Efficiency of set analysis with If statement

Dear Qlikview User

I was wondering if anyone was able to give me any guidance as to what expression is going to be more efficient?

Option 1: Set Analysis with an If statement inside

=Sum({<data_source={"$(=if(_view_HSMR='SMR - All','SMR','HSMR'))"},Care_Group,HSMR.Diagnosis_Group-={'ALL'}>}HSMR.Spells)


Option2: A pick match with set analysis


=Pick(Match(_view_HSMR,'SMR - All','HSMR - 56 Diagnosis Groups'),
Sum({<data_source={'SMR'},Care_Group=, Treatment_Function=,HSMR.Diagnosis_Group-={'ALL'}>}HSMR.Spells),
Sum({<data_source={'HSMR'},Care_Group=, Treatment_Function=,HSMR.Diagnosis_Group-={'ALL'}>}HSMR.Spells))

Any help or guidance would be great, so we can adopt a blanket approach to other expressions

Kind Regards

Helen

3 Replies
Chanty4u
MVP
MVP

create a flag in script for if condition and use that flag in first set expression it will give more performance i believe

(=if(_view_HSMR='SMR - All','SMR','HSMR'

jonathandienst
Partner - Champion III
Partner - Champion III

Efficiency is quite situational - the best way is to test both expressions. If you put them in separate tables, you can use the calculation time in Document Properties | Sheets to evaluate the performance.

I would expect that if the cardinality of _view_HSMR is low (2 possible values?) then the performance impact on option1 will be small.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
shraddha_g
Partner - Master III
Partner - Master III

What is your dimension?