Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
noemibuscemi01
Partner - Contributor III
Partner - Contributor III

Nulls in the database, nulls in qlik sense

Hi everyone,

My question today is:

I've got some NULL values in my database, when I perform a sum on qlik sense it returns zero, but I want to show NULL as in the database or blank. 

I know that qlik sense treats nulls as zero values, what I tried to do is forcing nulls/blanks with an if statement (if field=0, '', field) but doing this way all zeros turn blank, but I only want that 0 because of nulls in the db turns blank. How can I distinguish these values?

 

Please help.

 

 

Labels (3)
1 Solution

Accepted Solutions
noemibuscemi01
Partner - Contributor III
Partner - Contributor III
Author

Found the solution!

=if (isnull(field1), '',
sum(field1)
)

View solution in original post

8 Replies
NitinK7
Specialist
Specialist

You Can try  if(  LEN(field)=0,  'NULL',  filed)

MayilVahanan

Hi @noemibuscemi01 

Try like below

If(Len(Trim(Field))=0 or isnull(Field), '', Field)

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
noemibuscemi01
Partner - Contributor III
Partner - Contributor III
Author

not working 😞

noemibuscemi01
Partner - Contributor III
Partner - Contributor III
Author

not working 😞

ArnadoSandoval
Specialist II
Specialist II

Hi @noemibuscemi01  @MayilVahanan @NitinK7 

Qlik features these system variables and statement to handle NULLs:

NullInterpret ; NullValue  and NullAsValue you should read their help pages.

I attached a demo project illustrating their usage.

Hope this helps

Arnaldo Sandoval
A journey of a thousand miles begins with a single step.
noemibuscemi01
Partner - Contributor III
Partner - Contributor III
Author

Thanks! I'll take a look 😊

noemibuscemi01
Partner - Contributor III
Partner - Contributor III
Author

Hi ArnadoSandoval,

Your links were really useful to better understand the null topic in Qlik.

However, I couldn't find a solution to my issue. The problem is that I have some nulls in the database and I want them to remain nulls in qlik too when I perform a sum. I know sums return zero values, is there a way to force the null value instead?

 

Attached some screenshots:
1- the field as it appears without applying filters, and it's ok in this way
2- the expression used to calculate that field
3- after I apply filters on year and on another field (RagioneSociale)

The 0 you see after I apply filters is a NULL value in the database and I want it to be a NULL (or a blank if it's simpler) in qlik too.

 

noemibuscemi01
Partner - Contributor III
Partner - Contributor III
Author

Found the solution!

=if (isnull(field1), '',
sum(field1)
)