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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
CK_WAKE
Creator
Creator

replace null to zero in table chart

Hi There, I have a table where Plant_no groups WORK_ORDER_KPI, HOT_JOINT_KPI, and K1VA_AGE_KPI, and summing them in the pivot table to replace null to zero does not give the correct values. All I want is to replace null with 0. Note: all the columns comes from diffrent table/ model.

Any hacks will be much appreciated. I have attached the data and screenshot of a table view to this post.

2 Solutions

Accepted Solutions
marksouzacosta

I think there is something wrong in your Load Script. These are my numbers with the Excel file you sent:

marksouzacosta_0-1721705857881.png

 

Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com

View solution in original post

CK_WAKE
Creator
Creator
Author

i believe so, i will check the data model.

View solution in original post

8 Replies
SterreKapteijns
Partner Ambassador
Partner Ambassador

If you want to fill the empty values with zeros you could use a mapping table:

Map_Null:

mapping load

Null(), 'Unkown' 

AutoGenerate 1;

MAP K1VA_AGE_KPI using Map_Null;

 

[table name]:

load

EmptyIsNull(K1VA_AGE_KPI) as K1VA_AGE_KPI

etc. 

 

you could also use an if-statement, if(len(trim(K1VA_AGE_KPI)) = 0, 'NA', K1VA_AGE_KPI) as ...

 

BrunPierre
Partner - Master II
Partner - Master II

Hi, both ALT() and Coalesce() functions are used to handle null values or to provide alternative values when encountering nulls or missing data.

CK_WAKE
Creator
Creator
Author

Hi @SterreKapteijns ,  and @BrunPierre 

Thanks for getting back. Unfortunately, the code you provided is not working. That is because not all the plant_no (dimension) will have hot joint kpi attached. But if I remove the dimension and keep only the hot joint column, it appears correct.
 
I have attached the screenshot to show how the table looks when I remove the dimension column (Plant_no) without removing it.

I appreciate your guidance here.

marksouzacosta

What if you add these columns as Measures instead of Dimensions?

marksouzacosta_0-1721699377023.png

 

Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com

CK_WAKE
Creator
Creator
Author

I tried to achieve this by summing it up. However, the summation gave me incorrect numbers. I randomly checked the number for Plant No: A801.4 DIS. It has a 50, 60, and 80 RISK SCORE , and it is correct; however, when I apply the summation it shows incorrect one. I hvae attached the sampel comparision below.  

marksouzacosta

I think there is something wrong in your Load Script. These are my numbers with the Excel file you sent:

marksouzacosta_0-1721705857881.png

 

Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com

CK_WAKE
Creator
Creator
Author

i believe so, i will check the data model.

CK_WAKE
Creator
Creator
Author

The issue was in the data model. After revising the script, it is working fine. Thanks all for your time in addressing this.