Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

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

Re: set analysis and variable

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

=median    instead of       =$(median_textbox)

7 Replies

Re: set analysis and variable

HI

Try like this

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

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

Hope that helps

Re: set analysis and variable

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

see attached file


talk is cheap, supply exceeds demand
Not applicable

Re: set analysis and variable

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

Not applicable

Re: set analysis and variable

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

Not applicable

Re: set analysis and variable

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

=median    instead of       =$(median_textbox)

Re: set analysis and variable

great. thanks for that bit of info.


talk is cheap, supply exceeds demand
sbobbyraj
Contributor III

Re: set analysis and variable

You can simply:

 

initialise the variable :

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

and calculate:

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

Community Browser