# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

New Contributor

## Variables with rank function in set analysis

Hi All,

I would like to use variable which stores rank function in set analysis.

This is the variable which I want to use in Set Analysis:

vVariable1=if((rank(fabs(\$(vABC)),4,2))=1,dim1)

where vABC keeps the Pick function with some variables.

This is the whole formula:

Count({<dim1={\$(vVariable1)}>}distinct measure1)

and it doesn't work.

When I put in the table dim1 and \$(vVariable1) it shows data correctly.

Do you have any idea what's wrong?

Thanks.

1 Solution

Accepted Solutions
New Contributor

## Re: Variables with rank function in set analysis

I found the solution.

If someone is interested you should define variable like this:

set Variable1 = rank(fabs(\$(vABC)),4,2))=1

and then use it in the measure this way:

Count({<dim1={"=\$(vVariable1)"}>}distinct measure1)

New Contributor

## Re: Variables with rank function in set analysis

I found the solution.

If someone is interested you should define variable like this:

set Variable1 = rank(fabs(\$(vABC)),4,2))=1

and then use it in the measure this way:

Count({<dim1={"=\$(vVariable1)"}>}distinct measure1)