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: 
Buliano
Contributor II
Contributor II

result of aggr/rank changes when used in arithmetic expression

I want to count, no matter the selection, how many systems with status “operational” or “development” and of type “information system” have a confidentiality code >=3, and then get a ranking on that value per owner.

I am doing this in a Measure.

My table lists owners as 1st row.

This code in the measure gets what I need:

Rank((count({1<[IS Status]={Operational, Development}, [Work type]={'Information System'}, ConfidentialityCode={">=3"}>}Name)),0,1)

This code too:

Aggr(Rank((count({1<[IS Status]={Operational, Development}, [Work type]={'Information System'}, ConfidentialityCode={">=3"}>}Name)),0,1), [Owner])

 

However, the moment I try to do any arithmetic operation with that code, I get different values for entries in the lower half of my ranking. I.e. if I add 0, the column is not the same as the previous one! Also if I use the num() function. So the following 4 entries give me different results for some of the items, bigger deviation as they are lower in the ranking.

0 + Rank((count({1<[IS Status]={Operational, Development}, [Work type]={'Information System'}, ConfidentialityCode={">=3"}>}Name)),0,1)

0 + Aggr(Rank((count({1<[IS Status]={Operational, Development}, [Work type]={'Information System'}, ConfidentialityCode={">=3"}>}Name)),0,1), [Owner])

Num(Rank((count({1<[IS Status]={Operational, Development}, [Work type]={'Information System'}, ConfidentialityCode={">=3"}>}Name)),0,1))

Num(Aggr(Rank((count({1<[IS Status]={Operational, Development}, [Work type]={'Information System'}, ConfidentialityCode={">=3"}>}Name)),0,1), [Owner]))

 

I'm lost at this point... how can I use those values for some operations?

Labels (2)
1 Solution

Accepted Solutions
Buliano
Contributor II
Contributor II
Author

I seem to have found the issue myself, so I'm replying for the records.

Rank() has two parameters, the 1st one is for the numeric value and the 2nd one is for the text value. I had configured them differently (0,1). When I just displayed the value, Qlik would show the text value, but when I did an operation, Qlik would use the numeric value.

The solution is to configure them equally (i.e. both as 1), so:

Rank((count({1<[IS Status]={Operational, Development}, [Work type]={'Information System'}, ConfidentialityCode={">=3"}>}Name)),1,1)

 

View solution in original post

1 Reply
Buliano
Contributor II
Contributor II
Author

I seem to have found the issue myself, so I'm replying for the records.

Rank() has two parameters, the 1st one is for the numeric value and the 2nd one is for the text value. I had configured them differently (0,1). When I just displayed the value, Qlik would show the text value, but when I did an operation, Qlik would use the numeric value.

The solution is to configure them equally (i.e. both as 1), so:

Rank((count({1<[IS Status]={Operational, Development}, [Work type]={'Information System'}, ConfidentialityCode={">=3"}>}Name)),1,1)