Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to Exclude Null Values from Calculated Expression?

Hi All,

How do i exclude Nulls from my Calculated Dimension Expression?

Below is my Code:

=if( aggr(rank(sum(People)),Service)<=vTopValue,Service)

SAMPLE TABLE:

ServicePeople
A200
B34
-676
-90

OUTPUT:

ServicePeople
A200
B34

Thanks in Advance.

25 Replies
Not applicable
Author

Hi Lucian,

It doesn't work, basically i need it to add the next row, incase i want Top 5 Sales, then one of the Rows is Null, then jump to next Row to get direct num Top 5

Regards.

Not applicable
Author

Hi Ruben,

so if i suppress, then is it possible to add 1 more row so that the Top Range would be correct, because if suppressed and my request was show me Top 5 of Sales: then if one row is Supressed it will show 4 rows, so now is it possible to add one more row in case to get correct Range?

Thanks.

rubenmarin1

Hi Thabiso, i don't know why is showing only 4 rows, if you tell 5 it should show 5.

Probably there are People unrelated to a service, and People with null service is in top five, lowering all other services one spot, can you check if this is what is happening?

Not applicable
Author

Hi,

it shows Error in Calculated Dimension.

any reason why?

Thanks.

rubenmarin1

If is this you can change calculated dimension to:

=if(aggr(rank(sum({<Service={"*"}>} People)),Service)<=vTopValue,Service)

rubenmarin1

Hi, what I posted in that post was for expression, not dimension.

Not applicable
Author

Hi,

it only shows 4 if i suppressed, but if i didin't then it shows 5, but the 5th one is null field but with the value on the other column and its basically high on them all.

so there's no other solution to exclude null and count the next row?

Not applicable
Author

Hi,

on the Expression i tried, and it works but still my top range is 5, it shows me 4, so i want it to add one more row so that it becomes 5 rows.

Thanks.

Not applicable
Author

Hi Thabiso

try this as the calculated dimension

If( Service <> null(),  if( aggr(rank(sum(People)),Service)<=vTopValue,Service) )

/Teis

rubenmarin1

Hi, i crated this data:

Data:

LOAD If(Service='', null(), Service) as Service, People;

LOAD * Inline [

Service,People

A,200

B,34

,676

,90

];

If I use the dimension if( aggr(rank(sum(People)),Service)<=2,Service)

If I use

=if( aggr(rank(sum({<Service={"*"}>} People)),Service)<=2,Service)

The difference between those two is that in the first, te null() service is on top 2, and Service B goes to Top3, so it doesn't show

In both I used sunindia's expression: =Sum({<Service = {'*?'}>}People)