Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
TF1002
Contributor
Contributor

How to convert null values to 0

Hi all,

I have a set of data with posting codes and the amount posted against them each period- I want to put these into a pivot table, however there are some periods where certain codes have nothing posted against them. When I export the data from the table, these are assigned a value of '-', rather than 0,  which messes up the template which I have to populate with this data. After researching and trying to work out how to convert these to 0, I found something about an option to set chart properties to 'populate missing cells' within Qlik View, which sounds like it would be ideal, but there doesn't appear to be an equivalent in Qlik Sense.

I have also tried several methods of manipulating the data to convert these to 0, but the issue is that these are not true null values, but rather missing values (type two, I believe!) so there is no data to convert. Does anyone have any suggestions on how to do this?

Thanks

6 Replies
Sandy1
Contributor II
Contributor II

I usually try the Alt() function to replace null or missing values by 0. Maybe you could give this a try if not done yet.
Syntax: Alt(expression, 0)
andrescc
Contributor III
Contributor III

Hi,

You could try to convert your null values with this

NullAsValue A,B;

Set NullValue = 'NULL';

LOAD A,B from x.csv;
Channa
Specialist III
Specialist III

try use

if ( isNull(Column),0,Column)

 

Channa
shloime
Contributor III
Contributor III

ymcmb
Contributor III
Contributor III

As Channa mentioned, you probably want something like:

if(isNull(ABC),0, ABC)

 

abhijitnalekar
Specialist II
Specialist II

Try this too

Coalesce(FieldName, 0) as FieldName

Regards,
Abhijit
keep Qliking...
Help users find answers! Don't forget to mark a solution that worked for you!