Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
oscarjakobsen
Contributor
Contributor

Beginner can't figure out set expression

Hello! I'm trying to get a set expression to give me share of  "Priokod=Akut 2 inom 4 tim" that has a "Median ledtid tim rem reg us stopp" of less than 4. I've tried several different ways to write this that Qlik seems to accept but it gives me 100% no matter what. I've also tried to write just {4} expecting to get the share that is exactly 4 but it's still giving me 100%. What am I doing wrong?

 

({$<[Median ledtid tim rem reg us stopp]={"<=4"},Priokod={'Akut 2 inom 4 tim'} >}[Antal Us]) / ({$<Priokod={'Akut 2 inom 4 tim'}>} [Antal Us])

Labels (2)
2 Replies
marcus_sommer

There is no aggregation specified. Before defining a set analyse condition it would be useful to check the aggregation itself  - purely and then with listbox-selections - and if it returned the expected results you transfers the selections step by step to the set analysis. Means at first applying:

sum([Antal Us]) // maybe also with min/max/avg()

with the relevant selections in [Median ledtid tim rem reg us stopp] and [Priokod].

Such approach may looking a bit inconvenient but is simple and an important part of a quality-evaluation and at least if it comes to unexpected results it will save much more time as looking for any errors in more complex expressions.

MeehyeOh
Partner - Creator
Partner - Creator

Try

 

Sum({$<[Median ledtid tim rem reg us stopp]={"<=4"},Priokod={'Akut 2 inom 4 tim'} >}[Antal Us])

/ Sum({$<Priokod={'Akut 2 inom 4 tim'}>} [Antal Us])