Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

set analysis and variable

Hello everyone,

Well I get an issue, and I've been woking on it since yesterday, and it's starting to give me a headache....

Here's the thing :

I've got a table with 2 columns :

LOAD * INLINE [

ID, SALARY

1,1234

2,4567

3,5467

4,904

5,3456

6,2123

];

I created a variables which is $(median) = (max(SALARY)-min(SALARY))/2

Now I want to count how many id's which have a salary over and below this variable

I tried :

  • count({<SALARY={">$(median)"} >}distinct  ID) -> It's not working.
  • count({<SALARY={' >$(median)'} >}distinct  ID) -> It's not working either. (simple quote)

I've tried many more things I saw in the forum, but no conclusive results.

I really need eveyone's help,

Wish you all the best,

Will

1 Solution

Accepted Solutions
Not applicable
Author

but you get the same results if you put in the first textbox

=median    instead of       =$(median_textbox)

View solution in original post

7 Replies
MayilVahanan

HI

Try like this

variable name -> median = (max(Salaray)-min(Salary))/2;

count({<SALARY={">$(median)"} >}distinct  ID)

Hope that helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Gysbert_Wassenaar

I've used this: sum(if(SALARY > $median ,1,0))

see attached file


talk is cheap, supply exceeds demand
Not applicable
Author

Nope, this doesn't work at all. the text box returns 0, please see attached files

Not applicable
Author

You forgot to put a '=' before the calculation ( (max(SALARY) - min(SALARY) ) / 2   )

Not applicable
Author

but you get the same results if you put in the first textbox

=median    instead of       =$(median_textbox)

Gysbert_Wassenaar

great. thanks for that bit of info.


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

You can simply:

 

initialise the variable :

median=(Max(SALARY)-Min(SALARY))/2

and calculate:

=count(if(SALARY>median,SALARY))